Thoughts about alternatives to barplot-with-error-bars
Posted
by gd047
on Stack Overflow
See other posts from Stack Overflow
or by gd047
Published on 2010-04-15T10:20:29Z
Indexed on
2010/04/15
10:23 UTC
Read the original article
Hit count: 286
I was thinking of an alternative to the barplot-with-error-bars plot. To get an idea by example, I roughly 'sketched' what I mean using the following code
library(plotrix)
plot(0:12,type="n",axes=FALSE)
gradient.rect(1,0,3,8,col=smoothColors("red",38,"red"),border=NA,gradient="y")
gradient.rect(4,0,6,6,col=smoothColors("blue",38,"blue"),border=NA,gradient="y")
lines(c(2,2),c(5.5,10.5))
lines(c(2-.5,2+.5),c(10.5,10.5))
lines(c(2-.5,2+.5),c(5.5,5.5))
lines(c(5,5),c(4.5,7.5))
lines(c(5-.5,5+.5),c(7.5,7.5))
lines(c(5-.5,5+.5),c(4.5,4.5))
gradient.rect(7,8,9,10.5,col=smoothColors("red",100,"white"),border=NA,gradient="y")
gradient.rect(7,5.5,9,8,col=smoothColors("white",100,"red"),border=NA,gradient="y")
lines(c(7,9),c(8,8),lwd=3)
gradient.rect(10,6,12,7.5,col=smoothColors("blue",100,"white"),border=NA,gradient="y")
gradient.rect(10,4.5,12,6,col=smoothColors("white",100,"blue"),border=NA,gradient="y")
lines(c(10,12),c(6,6),lwd=3)
The idea was to use bars like the ones in the second pair, instead of those in the first. However, there is something that I would like to change in the colors. Instead of a linear gradient fill, I would like to adjust the color intensity in accordance with the values of the pdf of the mean estimator. Do you think it is possible?
A slightly different idea (where gradient fill isn't an issue) was to use one (or 2 back-to-back) bell curve(s) filled with (solid) color, instead of a rectangle. See for example the shape that corresponds to the letter F
here. In that case the bell-curve(s) should (ideally) be drawn using something like
plot(x, dnorm(x, mean = my.mean, sd = std.error.of.the.mean))
I have no idea though, of a way to draw rotated (and filled with color) bell curves.
Of course, all of the above may be freely judged as midnight springtime dreams :-)
© Stack Overflow or respective owner