simple spplot problem (colorkey inside the plotting area)
Hy Georg For me it does not work Here s the Code # Rdata from http://gadm.org/countryies for Austria Bundesl?nder load("AUT_adm1.RData") library(sp) library(RColorBrewer) #percent per Bundesland in the correct order proznormal09=c(3.76,6.57,24.52,18.05,6.59,13.94,6.91,3.74,15.91) #produce factor bundeslfakt <- as.factor(as.numeric(cut(proznormal09, c(0,4,7,10,13,16,19,100))) levels(bundeslfakt) <- c("<4%", "4-7%", "13-16%", "16-19%",">19%") gadm$bundeslfakt <-bundeslfakt #the plot spplot(gadm, "bundeslfakt", col.regions=brewer.pal(5,"Reds"), main="Prozentverteilung nach Herkunftsbundesl\u00E4nder",key.space=list(x=0,y=0,corner=c(0,0))) produces a plot with the colorkey on the right side key.space is ignored I hope you can reproduce the Effect ;-) or tell me where I went wrong Rainer -----Urspr?ngliche Nachricht----- Von: Georg Ru? [mailto:research at georgruss.de] Gesendet: Dienstag, 15. M?rz 2011 20:08 An: Stowasser Rainer Cc: r-sig-geo at r-project.org Betreff: Re: [R-sig-Geo] simple spplot problem (colorkey inside the plotting area)
On 15/03/11 16:42:15, Stowasser Rainer wrote:
I'm using spplot to color regions of Austria Everything works fine But I like to have the colorkey INSIDE the plotting area (in the Bavaria window :-) space just puts it outside (top, bottom, left, right) as the spplot is a lattice object it should be possible I've tried the examples from http://r-spatial.sourceforge.net/gallery/ With the key.space=list(x=0.2,y=0.9,corner=c(0,1)) But this is simply ignored
Hi Rainer, I'm not sure whether I can help, but as soon as I include a "key.space=list(x=0, y=0, corner=c(0,0))" into an spplot call, the color key wanders into the plotting rectangle. The (minimal) full call here is: print(spplot(sppdf, zcol = i, key.space=list(x=0,y=0.01,corner=c(0,0)))) (inside the postscript device for producing eps figures) If you have, maybe post some code that we can try; or the structure of your data frame and some further lines to experiment with. Regards, Georg.
Research Assistant Otto-von-Guericke-Universit?t Magdeburg (nicht in Bayern :-) research at georgruss.de http://research.georgruss.de