[R-sig-Geo] Customizing levelplot coloring scheme in r
r@i@1290 m@iii@g oii @im@com
r@i@1290 m@iii@g oii @im@com
Wed Oct 12 16:44:11 CEST 2022
I have climate data that I have plotted on a global map using a levelplot map. However, I am trying to adjust the default coloring scheme to allow for only blue and red shades to appear. Ideally, I am trying to showcase blue for the positive values, and red for the negative values, along with a whitish coloring near and at 0. The default coloring scheme isn't bad, but I think a blue-red-white coloring would allow the plot to appear more visually pleasing. Here is the code that I have now to create my current levelplot:
#packages installed
library(raster)
library(ncdf4)
library(maps)
library(maptools)
library(rasterVis)
library(ggplot2)
library(rgdal)
library(sp)
library(gridExtra)
library(grid)
library(RColorBrewer)
#Using levelplot
FPlot10 <- levelplot(FDifference5,margin=F,at=c(seq(-50,150,10)),pretty=TRUE,
par.settings=mapTheme, main="Higher end")
FM10 <- FPlot10 + latticeExtra::layer(sp.lines(world.outlines.sp))
This yields a range of nice default colors, but I'd like to adopt something with only shades of red and blue (with white at and around 0). I can do it easily in ggplot, but levelplot appears completely different in using color commands (if they exist). Is that even possible in levelplot?
Thank you!
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list