[R-sig-Geo] Same scale legend in two or more maps

Jose.M.Pavia at uv.es Jose.M.Pavia at uv.es
Fri Apr 13 16:42:07 CEST 2012


Dear list,

I have a problem drawing my data in a map.
Anybody can help me?

This is the issue.

The same country in three different moments of time.
The country is divided in polygons. 
The division in polygons is not the same in the three moments of time.

We have a variable observed in each polygon in the three moments and
we want to construct a map for each moment using the same scale in the
three moments. This does not seem to be a problem. 
We reach this by:
rrt <- c(v1,v2,v3) # variables to map
brks <- quantile(rrt, seq(0,1,1/100)) # breaks
cols <- grey((length(brks):2)/length(brks)) # color palette

And then we plot the maps in the same window:
par(mfrow=c(1,3), mar=c(0,0,0,0))
plot(map1, col=cols[findInterval(v1, brks, all.inside=TRUE)])
plot(map2, col=cols[findInterval(v2, brks, all.inside=TRUE)])
plot(map3, col=cols[findInterval(v3, brks, all.inside=TRUE)])

The problem is using a same (grey) scale legend for the three maps and
just one!

Any idea?
Thanks in advance

Jose M Pavia



More information about the R-sig-Geo mailing list