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

From: Erik Iverson <eriki_at_ccbr.umn.edu>
Date: Wed, 31 Mar 2010 14:54:16 -0500

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. Received on Wed 31 Mar 2010 - 19:56:10 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:50:34 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