[R] How to draw a rect() behind a hist() ?

Jason Edgecombe jason at rampaginggeek.com
Wed Dec 1 02:27:09 CET 2010


Hi,

I have the following code:

hist(gps$heartpercent, breaks=5)
rect(90, par("usr")[3], 100, par("usr")[4], col = "red")

How do I get the rectangle to appear behind the histogram. Barring that, 
how can I make certain bars of the histogram to be a certain color?

Thanks,
Jason



More information about the R-help mailing list