Question

I have data about relative productivity for the Italian provinces. I built 5 groups according to the productivity level. Finally I want to represent such a scenario using a map of the Italian provinces, given that I CAN NOT use colours, since the printing of the map will be in a scale grey. I used the 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, for simplicity, the five groups are a,b,c,d,e

The result is here http://s9.postimg.org/m5co5g3nz/Rplot.png

I d like to do 2 more things I was not able to figure out.

First I need to add the legend, I 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 am not able to find a way to insert a code for group (c) in place of the ??. I tried with

"black"[density=24] 
"black"$density=24 

but they dont work

Secondly, for things look clearer, I may want to fill group (e) provinces with the same style of group (c) but with lines going to the inverse direction or even vertically. Even in this case I was not able to deal with it.

Thank you

Was it helpful?

Solution

You can specify density and angle in your legend like 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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top