[英]How to make both the markers and their tooltips visible using the leaflet package in R?
I am using the leaflet
package in RStudio
to plot a data set containing geographical co-ordinates on a map. 我正在
RStudio
使用leaflet
包在地图上绘制包含地理坐标的数据集。
My code stands as follows: 我的代码如下:
setwd("E:/RTests")
library(leaflet)
library(maps)
mydata <- read.csv("data1.csv", check.names=FALSE, stringsAsFactors = FALSE, header = TRUE, fileEncoding="UTF-8-BOM")
mydata <- data.frame(mydata)
leaflet(data = mydata) %>% addTiles() %>%
addMarkers (~lon, ~lat, popup = ~as.character(emp), label = ~as.character(emp))
The output is fine. 输出很好。 However, I now want the tooltips associated to the markers to be permanently visible.
但是,我现在希望与标记关联的工具提示永久可见。 As is, the tooltips appear only when I hover the mouse on the markers.
照原样,仅当我将鼠标悬停在标记上时,工具提示才会出现。
How can I achieve this? 我该如何实现?
Ok I got it! 好,我知道了!
leaflet(data = mydata) %>% addTiles() %>%
addMarkers (~lon, ~lat, popup = ~as.character(emp), label = ~as.character(emp), labelOptions = labelOptions(noHide = T))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.