lattice, add text to xyplot
On 2010.01.08 19:44:39, Ivan Gregoretti wrote:
Hello listers, Does anybody know how to add text to an xyplot without whipping out the existing curve? That's all. For instance, Lets say you generate a graph like this A <- data.frame(x = rnorm(100), y = rnorm(100)) xyplot(y ~ x, data = A) How would you add 'Hello world'? I tried 6.02E23 different partial solutions found on the web and failed. I just need one EXAMPLE that WORKS. Unfortunately, library(lattice) ?panel.text shows no examples. As you see, I bring you a formidable challenge.
A <- data.frame(x = rnorm(100), y = rnorm(100))
xyplot(y ~ x, data = A,
panel = function(...) {
panel.text(0, 0, "Hello world!")
panel.xyplot(...)
})
A whole lot of examples lattice are available here:
http://lmdvr.r-forge.r-project.org/figures/figures.html
If you plan on using lattice often, I highly recommend Deepayan Sarkar's
book.
Hope that helps,
~Jason
Thank you, Ivan Ivan Gregoretti, PhD National Institute of Diabetes and Digestive and Kidney Diseases National Institutes of Health 5 Memorial Dr, Building 5, Room 205. Bethesda, MD 20892. USA.
Jason W. Morgan Graduate Student Department of Political Science *The Ohio State University* 154 North Oval Mall Columbus, Ohio 43210