[R] Plotting text with lattice
McGehee, Robert
Robert.McGehee at geodecapital.com
Fri Sep 29 20:17:30 CEST 2006
Hello,
I've decided to take the leap and try my hand at the lattice package,
though I am getting stuck at what one might consider a trivial problem,
plotting text at a point in a graph. Apologies in advance if (that) I'm
missing something extremely basic.
Consider in base graphics:
> plot(1:10)
> text(2, 4, "Text")
In the above you will see text centered at the point (2, 4) on the
graph.
Now I would like to try to do the same thing using the lattice package:
> xyplot(x ~ x, data = data.frame(x = 1:10))
> ltext(x=2, y=4, labels="Text")
> panel.text(x=2, y=4, labels="Text")
> grid.text(label="Text", x=2, y=4)
> grid.text(label="Text", x=unit(2, "native"), y=unit(4, "native"))
None of the above four commands puts the "Text" at the (2, 4) point on
the graph. Any help with this would be appreciated! Also, if I have more
than one panel and would like to place text at different points on
different panels how would I do this?
Also, note that I'm hoping to use text to label interesting points in a
levelplot, but am using the above xyplot as an example.
Thanks,
Robert
Robert McGehee
Quantitative Analyst
Geode Capital Management, LLC
53 State Street, 5th Floor | Boston, MA | 02109
Tel: 617/392-8396 Fax:617/476-6389
mailto:robert.mcgehee at geodecapital.com
This e-mail, and any attachments hereto, are intended for us...{{dropped}}
More information about the R-help
mailing list