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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 13 Mar 2008 10:55:48 +0000 (GMT)

On Thu, 13 Mar 2008, Tom La Bone wrote:

> Thanks for all of the suggestions. The key key here seems to be using the
> "par" function to change the coordinate system like so
>
> plot(rnorm(100), rnorm(100))
> op <- par("usr")
> par(usr = c(0, 1, 0, 1))
> text(0.5,0.5,"TEST")
> par(usr = op)
>
> Prof Ripley commented that this approach will also work on log plots, but I
> don't think I completely understand what is going on because this does not
> work for me
>
> plot(rlnorm(100), rlnorm(100),log="xy")
> op <- par("usr")
> par(usr = c(0, 1, 0, 1))
> text(0.5,0.5,"TEST")
> par(usr = op)
>
> Any hints on what I am doing wrong with the log plots? Thanks again for the
> help.

You need

par(usr = c(0, 1, 0, 1), xlog=FALSE, ylog=FALSE)

to set up a non-log coordinate system.

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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 - 10:58:26 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