我相对较新r
并创造传单情节为此我需要一个白色背景代替grey.
我遇到了这个SO发布相同内容:传单地图的空白、白色背景 https://stackoverflow.com/questions/45989920/blank-white-background-for-leaflet-map并尝试过:
情节代码:
daily_leaflet_plt <- ind_states %>% leaflet(options = leafletOptions(zoomControl = FALSE,
dragging = FALSE,
minZoom = 3,
style = list(
"background-color" = "white"
)
)) %>%
addPolygons(
label = label_daily,
labelOptions = labelOptions(
opacity = .6,
style = list(
"color" = "white",
"background-color" = "black",
"font-size" = "15px",
"border-color" = "rgba(0,0,0,0.5)"
)
),
stroke = TRUE,
color = "white",
dashArray = "3",
weight = .2,
smoothFactor = .5,
opacity = 1,
fillOpacity = 0.5,
fillColor = ~ pal_daily(Daily_confirmed),
highlightOptions = highlightOptions(weight = .5,
fillOpacity = 1,
bringToFront = TRUE)) %>%
addLegend(position = "bottomleft",
pal = pal_daily,
values = ~ ind_states$Daily_confirmed,
title = "Daily Confirmed Cases",
opacity = 0.7)
css按照SO帖子:
```{r results="daily_leaflet_plt"}
cat("
<style>
.leaflet-container {
background: #FFF;
}
</style>
")
```
但这不起作用,我怎样才能在 rmarkdown 和闪亮的传单 plt 中获得白色背景空间,因为最终我将在闪亮中使用它。
我还在另一篇 SO 帖子中提出了这个问题,该帖子的措辞不同且仍未得到答复:如何更改r中多边形周围传单地图的颜色? https://stackoverflow.com/questions/68761699/how-to-change-color-of-leaflet-map-around-the-polygon-shape-in-r