Oehler, Friderike (AGPP) wrote: > Dear list members, > > I am still struggeling with spplot. Sorry for being that unprofessional, but > honestly I find the spplot help page quite hard to understand. (Many thanks > Edzer for the very helpful hint a few days ago.) > > 1) My first plot actually works all fine, but the colours seem to loop, i.e. > the same colour is assigned to level 1 (20, "Immature adults") and 4 > (80,"Egglaying"). Why is that and how can I change it? > > ad1942$TYPE<-as.factor(ad1942$TYPE) > colpal=colorRampPalette(c("yellow","orange","darkred"), bias=1, > interpolate=("linear")) > spplot(ad1942, zcol="TYPE", cuts=c(20,30,40,80), legendEntries=c("Immature > adults","Mature adults","Maturity unknown","Egglaying"), > col.regions=colpal(nlevels(ad1942$TYPE)), scales=list(draw=TRUE), sp.layout = > list("sp.polygons", EA)) > This cannot work, as colpal is not a function. Or is it? > 2) My second plot also works fine so far: > > arrow=list('SpatialPolygonsRescale', layout.north.arrow(), offset=c(50,15), > scale=2) > line1<-list("sp.lines", WE, type="l", col="blue") > line2<-list("sp.lines", NS, type="l", col="blue") > points <- list("sp.points", ad1942, pch=19, col="red", cex=0.8) > spplot(EA, zcol='ADM0_CODE', sp.layout=list(points,line1,line2, arrow), > scales=list(draw=TRUE), xlim=c(30,52), ylim=c(-10,18), > col.regions='transparent', colorkey=FALSE, main="Reported locust swarms", > sub="1942") # EA is an imported shape-file as SpatialPolygonsDataFrame > > However I would like to add the "TYPE" as z-value to the points again. The > following does not seem to work. All points are plotted in blue. Any > suggestions? > That is very hard to see from here.
Please use examples that are reproducible for people on the list. Also consider providing simple examples, start with spplot-ing without any arguments, then start using arguments and tell us where you got stuck. -- Edzer > points <- list("sp.points", ad1942, zcol="TYPE", pch=19, > col.regions=colpal(nlevels(ad1942$TYPE)), cex=0.8) > > MANY THANKS in advance!!! > Friderike > > > [[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 > _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo