我正在使用ggplot2
制作地图,并且我希望关闭一些点标签(在地图边缘或可能是边距)地图上有一些描述该点的文字。例如,以下代码生成:
require(tidyverse)
# UK Base polygon
UK <- map_data(map = "world", region = "UK",interior = T)
# Cities to plot as geom_points
UK_cities <- world.cities %>%
filter(country.etc == 'UK')
# Filter for the ones of interest
UK_cities <- UK_cities %>%
filter(name %in% c('London',
'Edinburgh',
'Glasgow',
'Birmingham',
'Edinburgh'))
# plot with ggplot
ggplot(data = UK, aes(x = long, y = lat, group = group)) +
geom_polygon(aes(x = long, y = lat, group = group),fill = 'grey80',
color = 'grey80') +
geom_point(data = UK_cities,aes(long, lat,group = name))+
geom_text(data = UK_cities,
aes(long, lat,label = name,group = name),
color = 'black',
size = 3)+
coord_map()+
theme_void()
我的问题是:可以geom_label
&#39;绘制&#39;到达给定点的一条线并位于地图/地块的其他位置?我想要伦敦&#39;伦敦&#39;有一小部分信息,即人口等等,是否有办法做到这一点?