On Thu, May 7, 2009 at 12:02 PM, Greg Snow <greg.s...@imail.org> wrote:
> From the help for panel.levelplot in the section on 'col.regions':
>
> " the exact number being one
>          more than the length of 'at'"
>
> was what I based my assumption on (also the "not longer than at" phrase in 
> the last sentence on recycling).

Thanks, that's definitely a documentation bug. I've reorganized the
documentation for levelplot colors (hopefully for the better). Should
show up in the next update.

-Deepayan

>
> The second part was somewhat speculation on my part, automatically adding 
> -Inf and Inf would mean that you would not need to make sure to span the 
> range of the data, but on the other hand, it would make it hard to exclude 
> values outside the region as in your example, arguments could be made for 
> either direction, the current behavior is probably best overall.
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
>
>
>> -----Original Message-----
>> From: Deepayan Sarkar [mailto:deepayan.sar...@gmail.com]
>> Sent: Wednesday, May 06, 2009 6:35 PM
>> To: Greg Snow
>> Cc: Antje; r-h...@stat.math.ethz.ch
>> Subject: Re: [R] levelplot question
>>
>> On Tue, May 5, 2009 at 8:58 AM, Greg Snow <greg.s...@imail.org> wrote:
>> > The function that is doing the color assignments is level.colors in
>> the lattice package.
>> > Looking at the code confirms that the number of colors should be 1
>> less than the length
>> > of the at variable (the documentation implies that it should be 1
>> more, looks like a documentation bug to me).
>>
>> Could you point to the place where this is implied? I couldn't see
>> anything obviously wrong in ?levelplot or ?level.colors.
>>
>> > It is possible that at one time the author intended to prepend -Inf
>> and append Inf to the at
>> > vector so that it did not need to span the entire range of the data,
>> but that was not implemented.
>> > I think I would prefer that fix to changing the documentation.
>>
>> That is a slightly different issue though: e.g.,
>>
>> > level.colors(c(1, 2, 3), at = c(1.5, 2.5, 3.5), colors = FALSE)
>> [1] NA  1  2
>>
>> The first value doesn't fall in any interval, so gets a NA.
>>
>> level.colors() is mainly a helper function for levelplot(), and it is
>> important there that the first and last intervals not be open-ended.
>> levelplot() has no 'zlim' argument, and you need 'at' to restrict the
>> values shown, e.g.,
>>
>> levelplot(volcano, at = do.breaks(c(120, 200), 10))
>>
>> -Deepayan
>

______________________________________________
R-help@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.

Reply via email to