Czerminski, Ryszard
2010-Mar-31 19:31 UTC
[R] lattice: how to add points to the plot generated by levelplot()?
I am using levelplot() function from pkg:lattice and I want to add some points to the plot generated by levelplot() similarly as in basic R graphic sequence: plot(...); points(...), but it does not work. I was reading documentation for lattice, but so far without much success. I would very much appreciate some tips. Best regards, Ryszard -------------------------------------------------------------------------- Confidentiality Notice: This message is private and may ...{{dropped:11}}
Erik Iverson
2010-Mar-31 19:54 UTC
[R] lattice: how to add points to the plot generated by levelplot()?
Czerminski, Ryszard wrote:> I am using levelplot() function from pkg:lattice and I want to add some > points > to the plot generated by levelplot()It's best to include a small example of what you have done so far, and what you want to further do. Actual R code with a small sample dataset is great.> similarly as in basic R graphic sequence: plot(...); points(...), > but it does not work. > > I was reading documentation for lattice, but so far without much > success. > > I would very much appreciate some tips.Most base graphics functions like point have a grid equivalent. In this case, use grid.points. levelplot(runif(100)~runif(100)*runif(100), panel = function(...) { panel.levelplot(...) grid.points(.1, .1, pch = 2) }) I found the Lattice book and the "R Graphics" book invaluable, both are worth getting.
Walmes Zeviani
2010-Mar-31 23:06 UTC
[R] lattice: how to add points to the plot generated by levelplot()?
You can use levelplot(runif(100)~rep(1:10, each=10)+rep(1:10, times=10)) trellis.focus("panel", 1, 1, highlight=FALSE) lpoints(runif(100,0,10), runif(100,0,10), pch=2, col=2, cex=2) trellis.unfocus() # or levelplot(runif(100)~rep(1:10, each=10)+rep(1:10, times=10), panel=function(...){ panel.levelplot(...) grid.points(runif(100,0,10), runif(100,0,10), pch=2) } ) Walmes ----- ..ooo0 ................................................................................................... ..(....)... 0ooo... Walmes Zeviani ...\..(.....(.....)... Master in Statistics and Agricultural Experimentation ....\_)..... )../.... walmeszeviani at hotmail.com, Lavras - MG, Brasil ............ (_/............................................................................................ -- View this message in context: http://n4.nabble.com/lattice-how-to-add-points-to-the-plot-generated-by-levelplot-tp1747260p1747499.html Sent from the R help mailing list archive at Nabble.com.