Plotting a map with lines density in place of colours in R: legend and lines -
i have data relative productivity italian provinces. built 5 groups according productivity level. want represent such scenario using map of italian provinces, given can not use colours, since printing of map in scale grey. used following:
library(spdep) library(spectralgp) library(maptools) library(gstat) library (rcolorbrewer) plot(submap.a,col="beige",border="black",axes=t, xlim=c(7,20), ylim=c(36,48)) plot(submap.b,col="darkgrey",border="black",add=t) plot(submap.c,col="black",border="black",add=t,density=24) plot(submap.d, col="grey30",border="black",add=t) plot(submap.e,col="grey13",border="black", add=t)
where, simplicity, 5 groups a,b,c,d,e
the result here http://s9.postimg.org/m5co5g3nz/rplot.png
i d 2 more things not able figure out.
first need add legend, tried with
legend_map <- c("a", "b","c", "d", "e") legend(17,47,legend=legend_map,fill=c("white","darkgrey", ??,"grey30","grey13"),bty="n",cex=0.6)
i not able find way insert code group (c) in place of ??. tried
"black"[density=24] "black"$density=24
but dont work
secondly, things clearer, may want fill group (e) provinces same style of group (c) lines going inverse direction or vertically. in case not able deal it.
thank you
you can specify density
, angle
in legend this:
legend(17,47,legend= legend_map, fill=c("white","darkgrey", "black","grey30","grey13"), density = c(na,na,24,na,24), angle = c(na,na,30,na,110), bty="n",cex=0.6)
Comments
Post a Comment