Skip to content
Prev 212536 / 398500 Next

Histogram color

Here is another approach:

x <- rnorm(100)

tmp <- hist(x, plot=FALSE)
plot(tmp, col='blue')
tu <- par('usr')
par(xpd=FALSE)
clip( tu[1], mean(x) - sd(x), tu[3], tu[4] )
plot(tmp, col='red', add=TRUE)
clip( mean(x) + sd(x), tu[2], tu[3], tu[4] )
plot(tmp, col='red', add=TRUE)