Skip to content
Back to formatted view

Raw Message

Message-ID: <4C507BDE.1050706@uni-muenster.de>
Date: 2010-07-28T18:50:06Z
From: Edzer Pebesma
Subject: spplot how to control variable scale with colorkey()
In-Reply-To: <AANLkTikg-wK5PXqiM-yVtCvJkhGQY0VUk+5fCJGS038o@mail.gmail.com>

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