【发布时间】:2014-10-02 07:34:21
【问题描述】:
我正在绘制两个栅格数据,生成下面的图像。
我想用取自第三个栅格数据的变量(具有相同的 bbox、像素大小等)为图中的每个点着色。 来自 R 用户的任何想法?这个操作在绘制数据集中的数据时非常容易,但是我不知道栅格……
我在这里附上生成图像的代码(简化,我认为您不需要所有绘图参数,例如 abline、xlab 等):
plot(mask(raster1, my_mask,maskvalue=0), #first raster, masked by my_mask
mask(raster2, my_mask,maskvalue=0), #second raster, masked by my_mask
col = alpha('black', 0.1), #the current color scheme
)
raster3 #raster with categorical variable,
#that should give the colors to the points in the graph
非常感谢!
【问题讨论】:
-
本质上,您只想以不同(特定?)颜色覆盖第三个栅格中的点?
-
嗨,罗曼,没错。颜色应由第三个栅格的栅格值给出。第三个栅格的数字很少(大约五个)。
-
你能做一个可重现的例子吗?
-
Oscar Perpiñán 提供的应该没问题,我猜。
标签: r scatter-plot raster