【问题标题】:R print map with ggmapR用ggmap打印地图
【发布时间】:2015-12-30 21:28:00
【问题描述】:

这是可重现的代码和平 如果你运行它,你会看到它打印了一个带有两个蓝点的地图。我想添加一个单独的点(不同的样式、颜色和形状)固定点。我尝试了第二个 geom_point 但不幸的是这只是给我一个警告。 你能帮我么? 问候 亚历克斯

require("ggplot2")
require("ggmap")
jet.colors <- colorRampPalette(c("#00007F", "red", "#007FFF", "yellow", "#7FFF7F", "cyan", "#FF7F00", "blue", "#7F0000"))
bbox<-c(-0.1505833, 51.5117722, -0.1363361, 51.5188167)
mp <- get_stamenmap(bbox, maptype = "toner", zoom = 16)


# prepare data points to plot
# First Set
dfE<-data.frame(c(-0.1456250,-0.1442639),c(51.51476,51.51492),c(0.018878676,0.111847050))
names(dfE) <- c("Longitude", "Latitude", "Error")

# Second Set
stationaryPoint<-data.frame(0.1422361,51.51516)
names(stationaryPoint) <- c("Longitude", "Latitude")

ggmap(mp, darken = 0) + geom_point(aes(Longitude, Latitude, colour =Error), data = dfE, size = 10)+geom_point(aes(Longitude,Latitude),data=stationaryPoint) 

【问题讨论】:

    标签: r ggplot2 ggmap


    【解决方案1】:

    使用

    stationaryPoint<-data.frame(-0.1422361,51.51516)
    

    而不是

    stationaryPoint<-data.frame(0.1422361,51.51516)
    

    原点位于地图边界之外。 ggplot2 将超出范围的坐标转换为NA。因此发出警告。

    【讨论】:

      猜你喜欢
      • 2015-12-22
      • 2018-06-28
      • 2021-06-06
      • 1970-01-01
      • 1970-01-01
      • 2015-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多