Andy Bunn
2011-Nov-15 21:12 UTC
[R] equal spacing of the polygons in levelplot key (lattice)
Given the example:
R> (levs <- quantile(volcano,c(0,0.1,0.5,0.9,0.99,1)))
0% 10% 50% 90% 99% 100%
94 100 124 170 189 195
R> levelplot(volcano,at=levs)
How can I make the key categorical with the size of the divisions equally spaced
in the key? E.g., five equal size rectangles with labels at levs
c(100,124,170,189,195)?
Apologies if this is obvious.
-A
R> version
_
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 14.0
year 2011
month 10
day 31
svn rev 57496
language R
version.string R version 2.14.0 (2011-10-31)
Dennis Murphy
2011-Nov-16 04:54 UTC
[R] equal spacing of the polygons in levelplot key (lattice)
Hi:
Does this work?
# library('lattice')
levs <- as.vector(quantile(volcano,c(0,0.1,0.5,0.9,0.99,1)))
levelplot(volcano, at = levs,
colorkey = list(labels = list(at = levs,
labels = levs) ))
HTH,
Dennis
On Tue, Nov 15, 2011 at 1:12 PM, Andy Bunn <Andy.Bunn at wwu.edu>
wrote:> Given the example:
> R> (levs <- quantile(volcano,c(0,0.1,0.5,0.9,0.99,1)))
> ? 0% ?10% ?50% ?90% ?99% 100%
> ? 94 ?100 ?124 ?170 ?189 ?195
> R> levelplot(volcano,at=levs)
>
> How can I make the key categorical with the size of the divisions equally
spaced in the key? E.g., five equal size rectangles with labels at levs
c(100,124,170,189,195)?
>
> Apologies if this is obvious.
>
> -A
>
> R> version
> ? ? ? ? ? ? ? ?_
> ?platform ? ? ? i386-pc-mingw32
> ?arch ? ? ? ? ? i386
> ?os ? ? ? ? ? ? mingw32
> ?system ? ? ? ? i386, mingw32
> ?status
> ?major ? ? ? ? ?2
> ?minor ? ? ? ? ?14.0
> ?year ? ? ? ? ? 2011
> ?month ? ? ? ? ?10
> ?day ? ? ? ? ? ?31
> ?svn rev ? ? ? ?57496
> ?language ? ? ? R
> ?version.string R version 2.14.0 (2011-10-31)
>
> ______________________________________________
> R-help at 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.
>