[R] lattice: how to add points to the plot generated bylevelplot()?
Bert Gunter
gunter.berton at gene.com
Wed Mar 31 22:18:38 CEST 2010
Tip 1: This sort of thing is done with panel functions. ?xyplot and
?panel.xyplot is where to start.
Tip 2: grid functions are generally not necessary, as translations of the
common ones are part of lattice. See ?panel.points
Tip 3: Deepayan's book provides a gentler explanation of these matters with
more examples than R's man pages.
Tip 4: Depending on your needs and predilections, you may prefer to use
ggplot2.
Bert Gunter
Genentech Nonclinical Biostatistics
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Erik Iverson
Sent: Wednesday, March 31, 2010 12:54 PM
To: Czerminski, Ryszard
Cc: R-help at r-project.org
Subject: Re: [R] lattice: how to add points to the plot generated
bylevelplot()?
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.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list