r - 如何防止R中Leaflet中的标签重叠?
问题描述
我一直在努力寻找标签不重叠的解决方案。请参考图片。有什么建议么?
可重现的代码:
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, 145.05513)), row.names = c(NA,
-10L), class = c("tbl_df", "tbl", "data.frame"))
library(leaflet)
leaflet() %>%
addTiles() %>%
addMarkers(lng = gyms$long, lat = gyms$lat,
label = gyms$suburb,
labelOptions = labelOptions(noHide = T, direction = 'auto')
, options = markerOptions(riseOnHover = T),
group = "gyms")
解决方案
推荐阅读
- java - 在 if 中使用 && 时出现此错误
- reactjs - 从服务唤醒器发送消息以响应某些不支持广播频道的浏览器中的组件
- django - Django 2.2.4 -- 无法让 ORM 模仿“group by”SQL 函数并获得预期结果
- drop-down-menu - 将 DropDownList 值获取到 POST 方法中
- javascript - Node js Fetch发送空正文
- c++ - 我有两棵二叉树。我想在不更改输入树的情况下深度复制两个二叉树的结果
- python - 使用 numba 原子操作函数时遇到问题 (cuda.atomic.compare_and_swap)
- java - 如何摆脱 stringBuilder 末尾的逗号和空格?
- grafana - 如何可视化周期性过程的周期时间?
- datagridview - 禁用列标题单击datagridview vb.net