gpt4 book ai didi

r - 通过单击图例选择或突出显示 map 上的数据

转载 作者:行者123 更新时间:2023-12-01 16:09:34 25 4
gpt4 key购买 nike

有没有办法通过单击 Rshiny 中的图例来选择或突出显示传单 map 上的数据?示例代码:

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)

最佳答案

mapedit 软件包的最新更新 (0.2) 可能会有所帮助:http://r-spatial.org/r/2017/06/09/mapedit_0-2-0.html

enter image description here

enter image description here

关于r - 通过单击图例选择或突出显示 map 上的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44580258/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com