[R] levelplot behaviour when "at" cuts the z range
Deepayan Sarkar
deepayan at stat.wisc.edu
Fri Aug 29 18:02:17 CEST 2003
On Friday 29 August 2003 05:22, Edzer J. Pebesma wrote:
> Consider the following examples:
>
> library(lattice)
> x = c(1,1,2,2)
> y = c(1,2,1,2)
> z = 1:4
> levelplot(z~x+y,at=c(.5, 1.5, 2.5, 3.5, 4.5)) # correct
> levelplot(z~x+y,at=c(.5, 1.5, 2.5)) # ?
>
> The second plot is clearly incorrect. However, I don't know
> what correct behaviour is: ignore everything above 2.5 and
> issue a warning? Reject at values that do not cover the
> data range, and issue an error message? I think I prefer
> the second, as it does not hide extremes.
Definitely a bug, the color vector was just being recycled. I seem to have
inadverdently fixed this a couple of days ago while making some related
changes, and now the z-values that are out of bounds are simply not shown (as
would happen if the corresponding z-values were NA). Does that sound
acceptable ? I don't like your second option because users may knowingly want
to do something like this (sort of what xlim and ylim are for).
I'll send you the modifications off-list for you to try out.
Deepayan
More information about the R-help
mailing list