[R-sig-Geo] spplot and diverging colorbrewer palette
edzer.pebesma at uni-muenster.de
Fri May 30 17:55:47 CEST 2008
> z = rnorm(100)
try the colorkey argument in spplot, it should get passed on to spplot,
which wraps levelplot.
Julien Barnier wrote:
> Hi to all,
> A little question about using a diverging colorbrewer palette with
> spplot. If you try the following code :
> nc <- readShapePoly(system.file("shapes/sids.shp", package="maptools"), proj4string=CRS("+proj=longlat +datum=NAD27"))
> nc at data$AREA2 <- nc at data$AREA - 0.1
> spplot(nc, c("AREA2"), col.regions=brewer.pal(7, "RdBu"), cuts=6,scales=list(draw = TRUE))
> you should get a map of a (very dummy) variable which takes value
> below and above zero. So I'd like the «0» value to be exactly at the
> point where colours are changing from red to blue. However, with this
> method it only works when «0» is exactly at the center of the scale.
> Do you have any idea on how I could obtain the result I would like,
> without specifying manually the cut points with «cuts» and «at» ?
> Thanks in advance, and sorry if my question is not really clear, as I
> am quite new to spplot...
More information about the R-sig-Geo