I have a rasterstack, which I am trying to plot in R by spplot:
rasterstack
class : RasterStack
dimensions : 2803, 5303, 14864309, 3 (nrow, ncol, ncell, nlayers)
resolution : 0.008333333, 0.008333333 (x, y)
extent : 60.85, 105.0417, 15.95833, 39.31667 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
names : layer.1, layer.2, layer.3
min values : -1.819715, -1.800774, -1.835778
max values : 6.5533, 6.5533, 6.5533
I want a colorscale from red to blue, with white in the centre. I achieved the color scale through this code:
devtools::source_gist('306e4b7e69c87b1826db')
plot2<-diverge0(rasterstack, ramp='RdBu')
However when plotted the spatial map shows very light colors, which cannot be visually easy to see. I would like to make a colorscale that is much darker and visually visible.
Reproducible raster:
library(raster)
r1 <- r2 <- r3 <- raster(nrow=10, ncol=10)
values(r1) <- runif(ncell(r1))
values(r2) <- runif(ncell(r2))
values(r3) <- runif(ncell(r3))
s <- stack(r1, r2, r3)
Note that the reproducible rasters do not have the same raster stack minimum and maximum values, I would appreciate it if someone could guide by my actual rasterstack
min and max values. (Secondly I would like the colorscale to go from red white to blue)