【发布时间】:2016-04-29 17:58:42
【问题描述】:
我正在使用 R 的绘图功能绘制下面的图。这个情节 以不同点值的形式表示,是从南美洲巴西海岸的不同位置获得的。图中的色点因值向量而异。
为了在此图中更好地代表南美洲海岸,我想在下方插入一个地理参考文件,以显示海岸线。我希望这些点留在海岸线上以便更好地表示。有可能在 R 中做到这一点吗?
我已经有一个地理参考图像,我正在使用下面的代码来绘制点图。
coordinates = data[,2:3]
groups = data[,4:9]
## Scale the groups so they are all between 0 and 1
max.groups = max(groups)
min.groups = min(groups)
scaled.groups = (groups-min.groups)/(max.groups-min.groups)
# Plot with color gradient
max.saz = max(groups$G1)
min.saz = min(groups$G1)
scaled.saz = (groups$G1-min.saz)/(max.saz-min.saz)
## Colors ranging from red (very) to blue (little)
saz.colors = rgb(red=scaled.saz,green=0,blue=(1-scaled.saz))
plotG1 = plot(coordinates$long, coordinates$lat, pch = 16, cex = 2, col = saz.colors, bg = saz.colors, xlab="Longitude (Wº)", ylab="Latitude (Sº)")
【问题讨论】:
-
你有什么样的地理参考文件?形状文件?
-
不,这只是 TIF 格式的地理参考图像。