[R] Plotting colors on a world map

dxc13 dxc13 at health.state.ny.us
Mon May 11 16:32:13 CEST 2009


Hi useR's

I have created a simple map of the world using the following code:
m <- map(xlim=c(-180,180), ylim=c(-90,90))
map.axes()

I then create a grid of dimension 36x72 using the code:
map.grid(m, nx=72, ny=36, labels=FALSE, col="black")

This gives 2592 grid cells.  In a separate data set of dimension 36x72, I
have 2592 temperature values (some missing values are present) ranging from
-20 degrees F to 90 degrees F.  

My question is, how can I create a reasonable color scheme (low temperatures
in light blue to higher temperatures in dark red) and plot the temperature
colors in their respective grid cells on the map?

Take this data matrix as some example data:
T <- sample(-10:90, 2592, replace=TRUE)
mat <- matrix(T, nrow=36, ncol=72)


Thanks in advance,
dxc13
-- 
View this message in context: http://www.nabble.com/Plotting-colors-on-a-world-map-tp23484524p23484524.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list