我一直在努力寻找标签不重叠的解决方案。请参考图片。有什么建议么?
可重现的代码:
gyms <-
structure(list(gym = c("Ashburton Pool and Recreation Centre",
"Brunswick Baths", "Casey Aquatic and Recreation Centre", "Hawthorn Aquatic & Leisure Centre",
"Macleod Recreation & Fitness Centre", "Northcote Aquatic & Recreation Centre",
"RecWest Footscray", "Aquahub", "Knox Leisureworks", "Waves Leisure Centre"
), suburb = c("Ashburton", "Brunswick", "Narre Warren", "Hawthorn",
"Macleod", "Northcote", "West Footscray", "Croydon", "Boronia",
"Highett"), lat = c(-37.8664, -37.77111, -38.02074, -37.82054,
-37.72407, -37.76906, -37.7946, -37.80099, -37.85752, -37.95049
), long = c(145.08518, 144.96023, 145.29975, 145.03313, 145.06882,
145.01182, 144.87968, 145.28072, 145.27868, …Run Code Online (Sandbox Code Playgroud) 我是一个有空间数据的完整新手.我有以下代码成功绘制有界地图.我想补充一下,data.frame存储点.我提前道歉,因为无法从OpenStreetMap文档中找到这个...下面的代码:
library(OpenStreetMap)
stores <- data.frame(name=c("Commercial","Union","Bedford"),
longitude=c(-70.25042295455933,-70.26050806045532,-70.27726650238037),
latitude=c(43.657471302616806,43.65663299041943,43.66091757424481))
lat <- c(43.68093,43.64278)
lon <- c(-70.29548,-70.24097)
portland <- openmap(c(lat[1],lon[1]),c(lat[2],lon[2]),zoom=15,'osm')
plot(portland,raster=TRUE)
#can't figure out what to put here.
Run Code Online (Sandbox Code Playgroud)
我怀疑商店的格式不适合空间数据.
我有Google地图和带有文本标签的坐标列表。预览时,标签重叠,因此变得不可读:
library(ggmap)
WPmap <- qmap(c(lon=4.80324, lat=52.40738), zoom = 12, source = "google")
Run Code Online (Sandbox Code Playgroud)
表kaart_rtw:
Naam lat lon
1 Nieuw-Zeelandweg 52.40466 4.80214
2 Portsmuiden 52.39014 4.78554
3 Westhavenweg 52.41602 4.82282
4 Westhavenweg 52.41702 4.82282
5 Westhavenweg 52.41802 4.82282
6 Deccaweg 52.40196 4.83910
7 Coenhavenweg 52.40364 4.86195
AmsterdamMap + geom_text(data = kaart_rtw, aes(label = kaart_rtw$Naam, x = X, y = Y))
Run Code Online (Sandbox Code Playgroud)
有没有办法停止重叠?