[R] Drawing a rectangle around a barplot()

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Thu Dec 2 11:46:33 CET 2004


I want to draw a rectangle behind a barplot such that it highlights
those particular bars from the rest of the plot.  I have figured out how
to draw a barplot(), and then how to draw a rectangle of the correct
shape and size (using rect()), but when I use rect() it draws over the
top of the bars, and then when I re-draw the bars, it draws with a white
background, thus eliminating my rectangle!  I can't use box() as I don't
want to draw a box round my entire plot, I just want to draw a box as
the background to certain subsets of the bars.

Can anyone help?  (those of you familiar with microsoft word/excel
drawing tools, I want something similar to the command "send to back"
such that one drawing object is placed behind the others)

Thanks in advance


More information about the R-help mailing list