[R] Colorramp in Maptools, how to choose min and max values for the fg= argument
schaber
kschaber at ipp.mpg.de
Tue Sep 21 17:42:25 CEST 2010
Hello,
I am using maptools for plooting geographical data.
The colour of the region indicates some region dependent value
(population for example).
I pass the colours of the regions to the plot.Map function by defining
the foreground colour:
jet.colors = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
"#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
n=100
cols <- jet.colors(n)
Intervalls = cut(as.numeric(Vector),n, na.rm=TRUE)
fgs <-cols[Intervalls] ## is there some option/possibility here to
choose colours differently ??
plot.Map(Shape.map, fg=fgs, ol=NA, bty="n", xlab="", ylab="", xaxt="n",
yaxt="n")
My problem is the following: I would like to choose minimal and maximal
value of the colour palette, different from the minimal and maximal
values of the Vector. For example: Vector=c(2,3,4,5,6), but the maximal
colour should correspond to 10 and the minimal to 0.
I know, that maptools is not the most actual solution to plot maps, but
I am building on an old code and therefore do not want to change it.
I would very much appreciate any help or hints!!
Katrin
More information about the R-help
mailing list