[R-sig-Geo] Visualize negative/poitive data using levelplot in R

Zilefac Elvis zilefacelvis at yahoo.com
Thu Feb 26 22:43:49 CET 2015


Hello,
I need your insigts on how to visualize/map data that spans negative and positive values. I have 6 rasters which have been stacked together (s) and will subsequently be plotted via levelplotfunction 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)# r6At 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 colorkeyProblem: rasters with smaller vs larger values get suppressed and the information on the map is not well visualized. How can I visualize such data using levelplot with this large range?You can generate 6 rasters with values within the ranges shown above to give me further clues.Thanks for your help! The colorkey must not be red to blue. Something likehttp://iges.org/grads/gadoc/colorcontrol.html "The Default Rainbow Palette" would do.


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list