绘制光栅非线性拉伸。除了栅格计算以外的任何其他方式?

问题描述 投票:0回答:1

我试图用Chelsa或WorldClim的生物气候变量生成整个世界的光栅图。

我无法生成漂亮的地图,尤其是在处理具有大范围值的降水数据时。尝试任何色标都会产生几乎单色的地图,因为只有极少数点降水量非常高,而世界其他地方则相对较低。

是否有一些优雅的方式如何在绘制地图时拉伸颜色?我更喜欢使用log或标准差的非线性拉伸。有没有办法不需要计算并保存全新的栅格?我已经尝试过功能形式光栅包stretch,但我的电脑无法在功能运行期间将数据分配到PC内存中。

r memory plot raster r-raster
1个回答
2
投票

对于地图合成,您无需创建新栅格,只需更改图例颜色范围即可。

library(raster)
library(classInt)
library(rasterVis)
library(RColorBrewer)

r <-getData('worldclim', var='bio', res=10)

levelplot(r[[12]], col.regions=colorRampPalette(brewer.pal(9, 'Blues')),margin=FALSE,main ='Normal breaks')

enter image description here

使用classIntervals()包中的classInt函数,您可以计算新的中断。

breaks <- classIntervals(r[[12]][!is.na(r[[12]])], n = 50, style = "quantile")

levelplot(r[[12]], at = breaks$brks, col.regions=colorRampPalette(brewer.pal(9, 'Blues')),margin=FALSE,main ='Quantile breaks')

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.