Hi all! I'm using ssplot for drawing a map of Austria and colour the nine provinces regarding their share of employment. Now I wanted to add the figures in each province and failed miserably. Using the locator() and text() function caused the error message "invalid graphics state". I try to show you what I have done below, maybe you can find a general fault in my codes. I know that it's probably not the shortest way to the finishing line, but I'm a starter and happy about every finish. ;) I'm really hoping for some helpful comments!
library(maptools) library(fields) library(raster) library(rgdal) library(RColorBrewer) library(rgeos) library(pixmap) library(classInt) library(sp) NUTS2<-readShapePoly("xxx.shp") shareub2012 <- read.csv("xxx.csv", header=TRUE, sep = ";", dec = ",",stringsAsF actors=F) mergeshareub2012 <- merge(shareub2012, NUTS2, by.x = "Bundesland", by.y = "NAME " ) sortmergeshare2012 <- mergeshareub2012[order(mergeshareub2012$ID),] col_no <- as.factor(as.numeric(cut(sortmergeshare2012$x, c(0, .075, .125, .25, .50)))) levels(col_no) <- c("< 7,5%", "7,5-12,5%", "12,5-25%","> 25%") sortmergeshare2012$col_no <- col_no NUTS2$col_no <- col_no myPalette<-brewer.pal(4,"Blues") shareplot2012 <- spplot(NUTS2, "col_no", col="black", col.regions=myPalette, par.settings=list(axis.line=list(col="transparent"))) shareplot2012 plot.new() locator() text(0.82421448,0.3897917,"12,41", cex=0.7) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.