Re: [R] putting text in the corner

From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>
Date: Fri 10 Feb 2006 - 04:41:04 EST

On Thu, 2006-02-09 at 17:18 +0100, Thomas Steiner wrote:
> I want to write some text in a corner of my plot.
> Is it possible to get the xlim and ylim of an open window?
> Or is there anything similar like
> legend(x="bottomright", inset=0.01,legend=...)
> for
> text(x=1,y=2, "test")
>
> Thomas

Try this:

 plot(1:10)

 # par("usr") defines the x/y coordinates of the plot region  usr <- par("usr")

 # Upper Left Hand Corner
 text(usr[1], usr[4], "test", adj = c(0, 1))

 # Lower Left Hand Corner
 text(usr[1], usr[3], "test", adj = c(0, 0))

 # Lower Right Hand Corner
 text(usr[2], usr[3], "test", adj = c(1, 0))

 # Upper Right Hand Corner
 text(usr[2], usr[4], "test", adj = c(1, 1))

See ?par and ?text for more information including the 'adj' argument to text().

HTH, Marc Schwartz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Feb 10 05:42:56 2006

This archive was generated by hypermail 2.1.8 : Sat 11 Feb 2006 - 03:06:21 EST