How to customise choropleth map tooltips in R shiny app

149 views Asked by At

I have tried to customise my choropleth map tooltips in R shiny app, which doesn't work. I tried both paste0 and paste, and it does not work either.

Here is my code:

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"))
 
    
})}
0

There are 0 answers