我试图在 R Shiny 应用程序中自定义我的 choropleth 地图工具提示,但它不起作用。我尝试了 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"))
})}