Skip to content
Prev 979 / 398506 Next

R-beta: plot annotation

On Thu, 21 May 1998, Bill Simpson wrote:

            
I would have expected legend() to be able to do this, but it can't -- if
a box is not drawn the background is not shaded.  However you can do it
manually:

Suppose s<-"||" is your text, and lx,ly are the coordinates where you want
it.

hh<-strheight(s)/2
ww<-strwidth(s)/2
rect(lx-ww,ly-hh,lx+ww,ly+hh,border=par("bg"),col=par("bg"))
text(lx,ly,labels=s)

This draws a rectangle big enough for the text in the current background
color and then writes the text.  You can adjust how much space there is
by changing the 2 to something smaller


Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._