[R] How can I make a lattice::levelplot block size uniform
deepayan.sarkar at gmail.com
Fri Mar 26 12:48:24 CET 2010
On Fri, Mar 26, 2010 at 7:03 AM, Lao Tse <laotse0 at gmail.com> wrote:
> Dear lattice::levelplot users,
> I would like to use levelplot to plot uniformly sized blocks.
> Here is an example:
> require (lattice)
> u = runif(10) * 10
> v = runif(10) * 10
> z = runif(10)
> levelplot ( z ~ u + v, aspect="iso" )
> The resultant figures have points (blocks) that are of variable size that
> attempt to fill in the space along each u, v dimension. Is it possible to
> force each point to have, for example, a size of 1 X 1 unit? I realise this
> can be easily accomplished with "image". I also understand that using
> lattice::xyplot tweaked with color gradients and square points can also do
> the job.
Yes, as in
xyplot(v ~ u, aspect="iso" , col = level.colors(z, at = pretty(z,
15)), panel = panel.rect, height = 1, width = 1)
> I would, however, like to keep using levelplot which I like very
> much and wonder (and hope) if I maybe I have missed some obvious option.
You will need to supply a modified panel function (essentially modify
the grid.rect() call in panel.levelplot).
More information about the R-help