Dear all,

I have been trying to colour my maps using the same variable at different 
points in time employing the classInt and the RColorBrewer palettes.
Although the matching between the map areas and data file is correct (I have 
checked), the colouring is wrong every time. I am sure the error is quite silly 
but I can’t understand where it lies…
I have tried using a custom made palette or fixed breaks, but the colouring 
just does not work the right way!
Any help on the matter would be greatly appreciated!

Ale

Library(classInt)
#number of class intervals
nclassint <- 7
# variable to be plotted
varofint <- varT1
#define class intervals
cat3 <- classIntervals(varofint, nclassint,style = "jenks")
categ <- cat3
colpal   = brewer.pal(nclassint,"RdBu")
# Code for map: I want the reverse of the palette, from blue to red
colors <- findColours(categ,rev(colpal))
bins <- categ$brks
lb <- length(bins)


plot(shapefile, col=rev(colpal),axes=F)
title("Total Fertility Rate 1981", cex=1)
legend(1096133,4844461,fill=rev(colpal),legend=paste(round(bins[-length(bins)],2)
                                        ,"-",round(bins[-1],2)),cex=0.6, 
bg="white")

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to