Dear R community, I am using R 2.1.1 on Windows XP, package lattice Version 0.12-5, and want to add text (sort of a dat-stamp actually) to the lower left corner of a lattice plot, prefarably _after_ the plot has been created. Here is a simple example what I do in base graphics: # base graphics:> plot(rnorm(100), rnorm(100)) > mtext(as.character(Sys.Date()), side = 1,line = -2, outer = T, adj 0, font = 1, cex = 0.7)How can I get the same using lattice? # lattice:> require(lattice) > xyplot(rnorm(100) ~ rnorm(100)) > ???
I think this message from the help archives might address your question (found using the query "lattice mtext" on R site search: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/51605.html. Hope this helps, Matt Wiener -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of RINNER Heinrich Sent: Friday, September 09, 2005 4:16 AM To: r-help at stat.math.ethz.ch Subject: [R] adding text to the corner of a lattice plot Dear R community, I am using R 2.1.1 on Windows XP, package lattice Version 0.12-5, and want to add text (sort of a dat-stamp actually) to the lower left corner of a lattice plot, prefarably _after_ the plot has been created. Here is a simple example what I do in base graphics: # base graphics:> plot(rnorm(100), rnorm(100)) > mtext(as.character(Sys.Date()), side = 1,line = -2, outer = T, adj 0, font = 1, cex = 0.7)How can I get the same using lattice? # lattice:> require(lattice) > xyplot(rnorm(100) ~ rnorm(100)) > ???______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
The following worked for me: > xyplot(rnorm(100)~ rnorm(100), key=list(text=list(title="mytext"),corner=c(0,0))) but I'm sure there are better ways of doing this (esp. if you need the key for the key!) -- Edzer Matt Wiener wrote: I think this message from the help archives might address your question (found using the query "lattice mtext" on R site search: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/51605.html. Hope this helps, Matt Wiener -----Original Message----- From: r-help-bounces at stat.math.ethz.ch <https://stat.ethz.ch/mailman/listinfo/r-help> [mailto:r-help-bounces at stat.math.ethz.ch <https://stat.ethz.ch/mailman/listinfo/r-help>] On Behalf Of RINNER Heinrich Sent: Friday, September 09, 2005 4:16 AM To: r-help at stat.math.ethz.ch <https://stat.ethz.ch/mailman/listinfo/r-help> Subject: [R] adding text to the corner of a lattice plot Dear R community, I am using R 2.1.1 on Windows XP, package lattice Version 0.12-5, and want to add text (sort of a dat-stamp actually) to the lower left corner of a lattice plot, prefarably _after_ the plot has been created. Here is a simple example what I do in base graphics: # base graphics:> plot(rnorm(100), rnorm(100)) > mtext(as.character(Sys.Date()), side = 1,line = -2, outer = T, adj 0, font = 1, cex = 0.7)How can I get the same using lattice? # lattice:> require(lattice) > xyplot(rnorm(100) ~ rnorm(100)) > ???