I need your insights on how to visualize/map data that span negative and positive values. I have 6 rasters which have been stacked together (s
) and will subsequently be plotted via the levelplot
function in R. Below are the max
and min
values for each raster
.
39.2887, 53.09207 (min, max) # r1
-32.4956, -27.25534 (min, max)# r2
-14.37683, -11.37742 (min, max)# r3
9.512934, 13.60197 (min, max)# r4
-4.993901, -1.851784 (min, max)# r5
-8.190711, -5.104764 (min, max)# r6
At the moment, I am able to produce my map via:
library(raster)
library(rasterVis)
library(colorRamp)
s <- stack(r1,r2,r3,r4,r5,r6)
themes2 <- colorRampPalette(c("darkred", "red3", "orange", "yellow", "lightskyblue", "royalblue3", "darkblue"))(19)
myat =unique(seq(floor(min(s)) ,ceiling(max(s)),length.out=20))
myat=round(myat,digits = 0)#
#themes <- rasterTheme(region=rev(brewer.pal(11,'RdYlBu')))
myColorkey <- list(at=myat,space = "right",labels=list(cex=1,at=myat))
if (dev.cur() == 1) x11(width=18,height=18)
levelplot(s, layout=c(3, 2), index.cond=list(c(1, 3, 5, 2, 4, 6)),col.regions=themes2,
margin=FALSE,xlab=NULL,at =unique(seq(floor(min(s)) ,ceiling(max(s)),length.out=20)),
par.strip.text=list(cex=0),colorkey=myColorkey,scales=list(alternating=F))
NOTE: I need a single colorkey common to all rasters.
Problem: for rasters with smaller ranges, the variation amongst cells is poorly conveyed - the information on the map is not well visualized. How can I visualize such data using levelplot
with this large overall range?
You can generate 6 rasters with values within the ranges shown above to give me further clues.
Thanks for your help! The colorkey does not need to be red to blue. Something like "The Default Rainbow Palette" would do.
"
I need a single, shared colorkey for all of these rasters. At the moment, rasters with smaller cell ranges show very LITTLE variation.