Florian, please try

noe$bez1 = factor(noe$bez, levels = rev(levels(noe$bez)))
spplot(noe, zcol="bez1", col.regions=rev(col), col="white", scales=list(draw = TRUE), colorkey=TRUE)

Florian Endel wrote:
Hi,

I downloaded and ploted maps from http://gadm.org/ for Austria and a special province:

### <CODE> ###

library(sp)
library(RColorBrewer)

# load from web
con <- url("http://gadm.org/data/rda/AUT_adm2.RData";)
print(load(con)) # gadm hold all the data!
close(con)

# select one province
noe = new("SpatialPolygonsDataFrame")
noe = gadm[gadm$NAME_1=="Nieder\xf6sterreich",]

noe$NAME_1 = factor(noe$NAME_1)
noe$NAME_2 = factor(noe$NAME_2)

# utf8
noe_bez_names = iconv(noe$NAME_2, "ISO_8859-2", "UTF-8")
noe$bez = factor(noe_bez_names)

# plot
col = rainbow(length(levels(noe$bez)))
spplot(noe, zcol="bez", col.regions=col, col="white", scales=list(draw = TRUE), colorkey=TRUE)

### </CODE> ###

everything just works fine, but the legend (colorkey) is ordered in the wrong direction...

How can I rearrange / sort the legend?

--
greets
FloE

_______________________________________________
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

Reply via email to