【发布时间】:2017-11-29 20:58:15
【问题描述】:
我正在使用 spplot 来绘制 shapefile。我需要根据shapefile的属性值给shapefile的每个点赋予不同的颜色。
我的 shapefile 属性表如下所示: Attribute_Table。我必须根据秋季,冬季,春季和夏季的值来绘制点(我总共有4个地块,每个季节1个)。
通过运行此代码(r_values 是我的 shapefile):
# Defining point size
point_size = 0.8
# Defining where cuts are
classes_R = seq(-1,1,0.05)
# Defining color of scale bar
my.palette_R = brewer.pal(n = 10, name = "RdBu")
spplot(r_values, zcol = c("Fall","Winter","Spring","Summer"), do.log = F,as.table = T,
pch = 20, cex = point_size, key.space = "right", col.regions = my.palette_R,
main = "R Values - P Model", colorkey = T, at=classes_R,
sp.layout=(list(new_layer_1,new_layer_2))) #sp.layout is for 2 other layers (you can see the states in gray and the lakes in blue in backround
我得到这个情节:Plot。
更改 classes_R 中的切割(类)不会更改结果图。
我想要获得的是每 0.05 个从 -1 到 +1 的切割的地图,以及带有这些切割的比例尺右侧的标签。
这里是下载包含一些数据的 excel 文件的链接。这是一个包含点坐标的数据框
https://drive.google.com/open?id=1WPyS5TFGCxBDNhJIJc_jKvFmJd5hthl4
【问题讨论】:
-
@Kamil 我添加了一个excel文件,里面有一些数据和每个点的坐标
标签: r plot customization shapefile