如何将数据框中的坐标放在 R 中的地图上?

How to put geocoordinates from a dataframe on a map in R?

我想为经度和纬度定义的多个位置绘制点和文本标签。它适用于单个位置,但我很难在 geom_point 中为一组数据扩展它。

library(ggplot2)
require(maps)

GER <- map_data("world", region = "Germany")

ggplot(GER, aes(x = long, y = lat, group = group)) +
  geom_polygon(fill="lightgray", colour = "white")+
  geom_point(aes(x = 13.404954, y = 52.520008), color="red")+
  geom_text(aes(x = 13.404954, y = 52.520008), label = "Berlin", color = "red", nudge_y = .2) 

df <- data.frame(name = c("Berlin", "Hamburg"), 
                 long = c(13.404954, 9.993682),
                 lat = c(52.520008, 53.551086))

# How to do it?
ggplot(GER, aes(x = long, y = lat, group = group)) +
  geom_polygon(fill="lightgray", colour = "white")+
  geom_point(aes(x = df$long, y = df$lat), color="red")

必须显式显示两个不同的数据集

ggplot(data = GER, aes(x = long, y = lat, group=group)) +
  geom_polygon(fill="lightgray", colour = "white")+
  geom_point(data = df, aes(x = long, y = lat, group=name), color="red")