I am using shiny app & unable to get a transparent background only in this plot. After looking at many SO post I have tried a lot of options but still unable to get transparent background.
As you can see in the above image, the covid virus shape shouldn't hide behind the plot background if plot has transparent background.
output$id_india_map_cases_daily <- renderPlot({
req(input$id_checkbox_tab1_cases_daily)
ind_states %>%
filter(Date == max(Date, na.rm = TRUE),
State.UnionTerritory != "India") %>%
ggplot(aes(fill = .data[[input$id_checkbox_tab1_cases_daily]], label = ST_NM)) +
geom_sf(colour = "grey", lwd = .1) +
theme_map() +
scale_fill_gradient2_tableau(
palette = "Sunset-Sunrise Diverging",
na.value = "grey50",
guide = "colourbar") +
theme(legend.position = "right",
legend.direction = "vertical",
plot.title = element_text(size = 20),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
strip.background = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.background = element_rect(fill = NA),
legend.key = element_rect(fill = NA))
Is there any other theme option I can try with ?
I have another similar map down below in the App that uses same theme options but that one has transparency in the background & this can be confirmed if one changes the theme from light to dark for eg. cyborg
(UPDATE: removed app url)
(Pls close the App ASAP as this is running on free version of shinyapp which has monthly time limit).