【发布时间】:2019-06-19 01:42:54
【问题描述】:
我正在使用小册子功能在闪亮的框架内创建交互式地图。除了传说之外,一切看起来都很棒。图例的颜色有些褪色,因此不能完美地代表多边形的颜色。怎么解决?
renderLeaflet ({
pal8 <- c("#FFFFE5", "#D9F0A3", "#78C679", "#006837")
bins=quantile(mapdata_1()$Per), na.color = "#808080", alpha = FALSE, reverse = F)
pal <- colorFactor(palette = pal8, domain =NULL, levels=(mapdata_1()$cat), ordered = TRUE, na.color = "#808080", alpha = FALSE, reverse = F)
leaflet (mapdata_()) %>%
addProviderTiles("CartoDB.Positron") %>%
clearControls() %>%
clearShapes()%>%
addPolygons(fillColor = ~pal(cat)) %>%
addTiles() %>%
setView(-82.706838, 40.358615, zoom=7) %>%
addLegend(position = "bottomright",
values = ~cat,
pal = pal,
title = (paste("%",input$Age_Group_map, input$sex_map, "in", input$Year_map)) ,
labFormat = labelFormat(
))
})
【问题讨论】:
-
看起来部分问题是图例是透明的,当您在
addLegend中设置opacity = 1.0时会发生什么? -
效果很好!非常感谢。