I am trying to levelplot certain stacked raster files on r using levelplot. the problem is the plot shows color ramp where lower values shows dark color and higher values show light color. Can you help me flip or invert the color ramp to show light color for lower values and darker shades for higher values, keeping the color palette as default.
following is the snippet from the code i used
levelplot(stacked_rasters, margin = FALSE, xlab = "", ylab = "", scales = list(draw = FALSE),
colorkey = list(labels = list(cex = 0.8, font = 2), height = 0.6),
ylab.right = list(label = expression(paste("SO"[2], " Column Amount (MM)")), rot = 90, cex = 1, x = 6),
add = FALSE)
To flip or invert the color ramp in a levelplot in R, you can use the rev() function to reverse the order of the colors in the color ramp. Here's an example of how you can modify your code to achieve this: