[R] Using layout and text together

Paul Murrell p.murrell at auckland.ac.nz
Sun Jul 14 22:40:38 CEST 2002


Hi


> This is my first time using this list and was wondering if someone could
> help me.
> 
> I have two graphs on a page which was obtained by using
> layout(matrix(c(2,1), 1, 2), widths=c(6,1.5))
> 
> I would like to place text next to each symbol in the second plot.  It is
> simple to place text anywhere in the first, but then when I enter
> coordinates that are supposed to be in the second (as found with the locator
> command), then they don't show up.
> 
> Any hints, tips and opinions are greatly appreciated!


You may be having trouble with the order in which you are doing
things(?)
You must do all the drawing you want to do in one graph before moving on
to the next graph.  The following works for me (and the text annotation
may help to show where drawing occurs) ...

layout(matrix(c(2,1), 1, 2), widths=c(6,1.5))
plot(1:10)
text(locator(3), letters[1:3])
text(10, 1, "Text drawn in coordinate system of \"first\" graph")
plot(10:1)
text(locator(3), letters[1:3])
text(10, 1, "Text drawn in coordinate system of \"second\" graph")

Hope that helps

Paul
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list