Re: [R] lattice: how to add points to the plot generated bylevelplot()?

From: Bert Gunter <gunter.berton_at_gene.com>
Date: Wed, 31 Mar 2010 13:18:38 -0700

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.

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. Received on Wed 31 Mar 2010 - 20:21:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 31 Mar 2010 - 20:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive