如何在 R shiny 应用程序中自定义分区统计图工具提示

How to customise choropleth map tooltips in R shiny app

提问人:yet 提问时间:5/12/2021 更新时间:5/12/2021 访问量:121

问:

我尝试在 R 闪亮的应用程序中自定义我的分区统计图工具提示,但不起作用。我尝试了 paste0 和 paste,但它也不起作用。

这是我的代码:

ui <- fixedPage(

titlePanel("Map"),
fixedRow(
    column(5
    ),
),
column(
    12,
    plotlyOutput('map',
                  width = 1000,
                  height = 1000)
    )
)
server <- function(input, output) {



output$map = renderPlotly({
    
    
    map<- country_choropleth(AADS_map,
                       num_colors=8,
                       text = paste0("value:", value)
                       )+
        scale_fill_brewer(palette="RdPu") +
        theme(plot.title = element_text (h = 0.5, size = 18),
              legend.title = element_text(size = 10),
              legend.text = element_text(size = 12)
        ) +
        labs(fill = "Number of Accident", 
             title = "The distribution of accidents in countries from 1981 to 2019")
    
   map <- ggplotly(map,
                   tooltip = c("text"))
 
    
})}
shiny-server r-plotly shinyapps choroplethr

评论

0赞 Ari 5/13/2021
请将此作为可重现的示例,如下所述:stackoverflow.com/questions/5963269/...

答: 暂无答案