[R] lattice package plots

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu May 11 17:25:53 CEST 2006


On 5/11/06, sundlm at rpi.edu <sundlm at rpi.edu> wrote:
> > > I am using the lattice packge for its levelplot and contourplot.  Is it
> > > possible to adjust the line thickness of the 'box' and tickmarks in
> these
> > > plots?
> >
> > Yes, e.g.
> >
> > levelplot(volcano, par.settings = list(axis.line = list(lwd = 3)))
> >
> > The actual width of the box is actually half the advertised value
> > because of clipping.
>
>
> Exactly what I needed, I appreciate the help.  Using your example, I've
> gained a significant amount
> of control over the look of my plots.
>
> Is there a way to print just a colorkey (maybe using draw.colorkey?)
> without a plot?  I like the way a
> levelplot looks with it's colorkey, but I need to generate the plot and
> colorkey in separate devices
> (separate .ps files).  Is this possible?

Sure, e.g.

library(lattice)
library(grid)
draw.colorkey(key = list(at = 0:50), draw = TRUE, vp = viewport(height = 0.9))

If you need to, you can access the value of 'key' from a levelplot object; try

levelplot(volcano)$legend$right$args

This is undocumented though, and not guaranteed (but likely) to remain
unchanged.

Deepayan




More information about the R-help mailing list