[R-sig-Geo] spplot how to control variable scale with colorkey()

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Jul 28 20:50:06 CEST 2010


On 07/28/2010 12:31 PM, Paulo Eduardo Cardoso wrote:
> While plotting with spplot, the legend space is reflecting the scale
> of the variable.
> 
> eg, by dping something like this:
> spplot(...,
> colorkey = list(at = c(0, 5, 10, 20, 50,100), labels = c("0", "< 5",
> "[5, 10)", "[10, 20)",
>  "[20, 50)", ">= 50"), space="bottom"))
> 
> spaces between each colour interval will be proportional to the scale
> of this particular variable.
> 
> Can one control this, forcing a equal interval space to the legend at colorkey?

afaik, not without changing the values of the underlying map plotted.
You can of course first transform the map to a factor, using your legend
boundaries (and labels):

library(sp)
data(meuse.grid)
gridded(meuse.grid) = ~x+y
meuse.grid$distf = factor(findInterval
(meuse.grid$dist,c(0,0.1,0.25,1)),labels=c("0-0.1", "0.1-0.25", "0.25-1"))
spplot(meuse.grid["distf"],col.regions=bpy.colors(3))


> 
> Paulo
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list