我正在尝试将多个空间图层绘制到一张地图上。我不能缝我的点到美国地图上。我正在使用ggplot来映射这些空间数据。在命令add = TRUE中添加点(坐标)到“midwst”地图上遇到问题。我可以将两者分开绘制,但可以使用一些帮助在midwst地图上获取坐标。我觉得我可能不会使用正确的包命令彼此,但不能告诉。在R中绘制多个图层
setwd("D:")
midwst <- readOGR(dsn="/ne_50m_states", layer="us")
fsites = read.csv(file = "/WHAT Baseflow//final_sites.csv", header=T,
sep=",")
#Identify pts and Change projection
coords <- SpatialPoints(fsites[,c("Longitude", "Latitude")])
projection(coords) <- CRS("+init=epsg:2163")
spTransform(coords,CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
+towgs84=0,0,0"))
#Extract States from US Map
plot(midwst, axes = T)
plot(coords, pch = 21, bg = "red", cex = .5, axes = T)
绘制多层的例子及其可能的转变已经错了,点在正确的地方的arent。 'bbox(coords)'说什么?如果你“绘制(坐标)”,然后添加一些轴作为参考('axis(1); axis(2)'),那么数字看起来是否正确? “fsites”的经度和纬度栏是否真的在EPSG:2163? – Spacedman
什么是'ggplot'与它有关?我没有看到你在这里使用它。 – Spacedman
你是否打算在第二个plot函数调用中执行'“add = TRUE”?你在文本中说'add = TRUE',但是你的代码有'axes = T'并且没有'add'参数。有些东西是不正确的...... – Spacedman