通过单击Rshiny中的图例,是否有任何方法在传单地图上选择或突出显示数据? 示例代码:通过点击图例选择或突出显示地图上的数据
library(shiny)
library(leaflet)
library(RColorBrewer)
library(leafletGeocoderRshiny)
ui <- fluidPage(
leafletOutput("map"),
p(),
actionButton("recalc", "New points")
)
server <- function(input, output, session) {
df = data.frame(x = rnorm(100), y = rexp(100, 2), z = runif(100))
pal = colorBin('PuOr', df$z, bins = c(0, .1, .4, .9, 1))
output$map <- renderLeaflet({ leaflet(df) %>%
addCircleMarkers(~x, ~y, color = ~pal(z)) %>%
addLegend(pal = pal, values = ~z)
})
}
shinyApp(ui, server)
我还没有看到任何可以实现这一点呢。会很有趣的知道。 –
包[** leaflet.extras **](https://github.com/bhaskarvk/leaflet.extras)具有通过突出显示链接图例和数据的功能。看到这个演示https://rpubs.com/bhaskarvk/geojsonv2,特别是例子2.1,2.2和3 – TimSalabim