[R] levelplot add line
Jeff Jorgensen
jcjorgensen at wisc.edu
Wed Feb 25 15:13:10 CET 2004
Deepayan,
Thanks for the quick response. Just to make sure I understand, let me
explain in a bit more detail what I am trying to do.
I have created a levelplot (with contour lines and colored regions), and
what I am trying to figure out now is how to add a series of horizontal
lines across the levelplot and also assign values or labels to the lines on
the alternative y-axis. Would I do this with the route you suggest below?
Thanks so much for the help,
Jeff
At 06:51 PM 2/24/2004 -0600, you wrote:
>On Tuesday 24 February 2004 18:03, Jeff Jorgensen wrote:
> > R folks,
> >
> > I can't seem to find the instructions in the help files for the lattice
> > package that explain how to add lines, such as with lines() or ?, to a
> > levelplot. I'd be grateful if someone could point me in the proper
> > direction.
>
>The general rule for all lattice functions is to write your own panel
>function. For example,
>
>data(volcano)
>levelplot(volcano,
> panel = function(...) {
> panel.levelplot(...)
> panel.abline(c(0,1))
> })
>
>lines() will not work for lattice, but you can use llines() instead.
>
>Of course, for anything more useful than this example, your panel function
>should make use of the data that's passed to the panel function. Exactly
>what would be passed depends on the function in question. For levelplot,
>the best place to look will be panel.levelplot, and similarly for other
>functions.
>
>Hth,
>
>Deepayan
More information about the R-help
mailing list