[英]Why does addPolylines work differently on an R Shiny leaflet map?
[英]R Leaflet - addPolylines - add region name constantly
如何在折線的中心添加名稱? 我添加了一段代碼:
為了使示例位於底部,我必須在哪里放置什么代碼? 文字應始終在此,不要彈出,隱藏或懸停。
對於主題地圖,在addPolylines上只是tm_text(“ county”)。 提前致謝!
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addMarkers(
lng= 125.781199, lat= 39.039555,
label="fun",
labelOptions = labelOptions(noHide = FALSE, direction = "bottom", offset=c(0,5))) %>%
addPolygons(data=data,
stroke=FALSE,
smoothFactor = 0.2,
fillOpacity = 0.8,
label = lapply(list, HTML),
color= ~pal(data$data)) %>%
addPolylines(data = county,
fillColor = "transparent",
color = "#000000",
stroke = TRUE,
weight = 1.5,
smoothFactor = 0.5,
group = "county") %>%
addLegend(position = "topright",
pal = pal,
values = data$data,
title = "",
opacity = 1,
labFormat = labelFormat(suffix = " %",
transform = function(x) 100 * x))
我認為您不能直接使用addPolygons()
來實現,但是您可以覆蓋純文本層。 在完整的示例中查看如何在小冊子中的多邊形頂部添加標簽的答案。
摘要是:
addLabelOnlyMarkers()
添加另一個addLabelOnlyMarkers()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.