R plot - normal curves with color gradient -
R plot - normal curves with color gradient -
how can create curves color gradient in r. take @ flame.
it should that. tried create normal curve , normal curve, technically speaking, can't create such figure bunch of normal curves because won't come downwards , intersect @ right spot on either side. how can create such figure in r? ideas?
the best i've been able far is:
par(bg="black") plot(seq(0.15,0.85,by=0.01), 5*dbeta(seq(0.15,0.85,by=0.01),10,10 ), type="l" , ylim=c(0,700) ) # sets plotting framework. for( in 1:200 ) { lines(x= seq(0.15,0.85,by=0.01), y= i*dbeta(seq(0.15,0.85,by=0.01),10,10 ), col= colorramppalette(c("yellow", "orange", "red", "hotpink", "violet", "blue", "lightblue", "lightgreen", "darkgreen", "black"))(200)[i], lwd=13) } par(bg="white")
i did find putting "black" color @ origin of series add together "glow" overall result, i'm not posting result.
-----------------this started , there successive approximation , tweaks appearing below:
plot(seq(0.15,0.85,by=0.01), 5*dbeta(seq(0.15,0.85,by=0.01),10,10 ), type="l" , ylim=c(0,100)) for( in seq(0.2, 5) ) { lines(seq(0.15,0.85,by=0.01), i*5*dbeta(seq(0.15,0.85,by=0.01),10,10 ) ) }
for colors:
plot(seq(0.15,0.85,by=0.01), 5*dbeta(seq(0.15,0.85,by=0.01),10,10 ), type="l" , ylim=c(0,130)) for( in 1:35 ) {lines(seq(0.15,0.85,by=0.01), i*dbeta(seq(0.15,0.85,by=0.01), 10,10 ), col=colorramppalette(c("yellow", "orange", "red", "violet", "blue", "lightblue", "lightgreen"))(35)[i], lwd=3) }
for black background , denser colors , fade black @ top:
par(bg = 'black') plot(seq(0.15,0.85,by=0.01), 5*dbeta(seq(0.15,0.85,by=0.01),10,10 ), type="l", ylim=c(0,130) ) for( in 1:35 ) { lines(seq(0.15,0.85,by=0.01), i*dbeta(seq(0.15,0.85,by=0.01),10,10), col=colorramppalette(c("yellow", "orange", "red", "violet", "blue", "lightblue", "lightgreen", "darkgreen", "black")) (35)[i], lwd=13) }
i noticed fading black aspect controlled line width @ sides. hadn't been expecting seems desirable feature. other aspect not addressed here possibility of adding transparency. there alpha argument in r rgb functions.
one useful trick finding colors byname:
grep("purple", colors(), value=true) [1] "mediumpurple" "mediumpurple1" "mediumpurple2" "mediumpurple3" "mediumpurple4" [6] "purple" "purple1" "purple2" "purple3" "purple4"
if playing iteration create gradient smoother need adjust ylim argument: take 0.5^9*0.5^9/beta(10,10)*[iterations] , since maximum @ x=0.5.
r
Comments
Post a Comment