Heather kindly provided me a reproducable example of this bug off-list, it is found below.
I corrected it, in cvs, it will be in the next sp version (to be released soon). Thanks! -- Edzer library(sp) library(maptools) nc <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], proj4string=CRS("+proj=longlat +datum=NAD27")) names(nc) # create two dummy factor variables, with equal labels: set.seed(31) nc$f = factor(sample(1:5,100,replace=T),labels=letters[3:7]) nc$f = factor(nc$f, levels = letters[1:7]) library(RColorBrewer) ## Two (dummy) factor variables shown with qualitative colour ramp; key <- spplot(nc, c("f"), col.regions=brewer.pal(7, "Set3"), scales=list(draw = TRUE)) nokey <- spplot(nc, c("f"), col.regions=brewer.pal(7, "Set3"), scales=list(draw = TRUE), colorkey=F) print(key, split= c(1,1,1,2), more=TRUE) print(nokey, split = c(1,2,1,2)) On 06/21/2010 10:44 PM, Heather Carmichael wrote: > I have been trying to plot using spplot(). My variable is a factor, but > some levels are unused. When I plot the map with a key (using the default > colorkey=T) everything plots fine. But when I remove the key (colorkey=F) > all of the colors map to the wrong factors (I am assuming this is because > some of the factor levels are unused). > > This maps as I would expect it, with the key: > spplot(worldmap, "mu.level", lwd=0.01, col="white", scales = list(draw = F), > colorkey = T, par.settings=list(fontsize=list(text=10, points=10)), > cuts=24, col.regions=colvec) > > > Is there any way to hide/get rid of the key without changing the plot (i.e. > without using colorkey=F)? > > Thanks! > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@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.pebe...@wwu.de _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo