问题
I am using the package mapview
to plot a 3D raster cube
from a raster stack
.
> S2_images
class : RasterStack
dimensions : 660, 1074, 708840, 6 (nrow, ncol, ncell, nlayers)
resolution : 10, 10 (x, y)
extent : 219800, 230540, 4097480, 4104080 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=30 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
names : L2A_T30ST//51_B02_10m, L2A_T30ST//51_B03_10m, L2A_T30ST//51_B04_10m, L2A_T30ST//51_B08_10m, L2A_T30ST//51_B11_20m, L2A_T30ST//51_B12_20m
min values : 1, 127, 6, 1, 88, 86
max values : 8702, 9090, 7589, 7322, 5379, 5474
With cubeview(S2_images)
I get this visualization with default colors:
My objective is to plot it using RGB colours. For reference, I have created an RGB composition using plotRGB
plotRGB(S2_images, r=3, g=2, b=1, scale=maxValue(S2_images[[1]]), stretch="lin")
According to ?cubeview
, col.regiosn
should be color (palette).See levelplot for details.
Any idea how to proceed to create a color palette out of the RGB composition that I can use as input in the cubeview
?
来源:https://stackoverflow.com/questions/54553138/rgb-colors-in-a-raster-cube-visualization-in-r