Re: [R] Specifying relative position of text in a plot

From: <Bill.Venables_at_csiro.au>
Date: Thu, 13 Mar 2008 10:16:10 +1000

Here is one way.

...

usr <- par("usr") # get user coordinates par(usr = c(0, 1, 0, 1)) # new relative user coordinates

text(0.1, 0.5, "Some text", adj = 0) # if that's what you want

par(usr = usr) # restore original user coordinates

...

If you were going to be doing this a lot, you could write a simple wrapper function to text(...) to incorporate this change to relative coordinates and back again.

Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA

Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile:                         +61 4 8819 4402
Home Phone:                     +61 7 3286 7700
mailto:Bill.Venables_at_csiro.au
http://www.cmis.csiro.au/bill.venables/

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Tom La Bone
Sent: Thursday, 13 March 2008 12:34 AM
To: r-help_at_r-project.org
Subject: [R] Specifying relative position of text in a plot

What is the simplest way to specify the location of text in a scatter plot
(created using the plot function) in relative terms rather than specific x-y
coordinates? For example, rather than putting text at (300,49) on a plot,
how do I put it 1/10 of the way over from the y axis and 1/2 of the way up
from the x axis? Thanks.

Tom

-- 
View this message in context:
http://www.nabble.com/Specifying-relative-position-of-text-in-a-plot-tp1
6002549p16002549.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 13 Mar 2008 - 00:34:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 13 Mar 2008 - 11:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive