I am using a shape file in leaflet plot & would like to have white
color space external to the outer boundary of polygon shape instead of default greyish color background like color but unable to do so.
tried with: leaflet(options = leafletOptions(style = list("background-color" = "white")))
complete code:
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)
Also tried by adding: addTiles(fill = "white") %>%
& addTiles(fillColor = "white") %>%
but got error.
Desired result example with some random image: (choropleth map with external white space)
Would appreciate any help !!
UPDATE
from SO post: blank, white background for leaflet map
As per above link I saved my plot as R object: daily_leaflet_plt
& ran below code but thats not working. I am not sure how to change css for this in rmarkdown
```{r results="daily_leaflet_plt"}
cat("
<style>
.leaflet-container {
background: #FFF;
}
</style>
")
```