title: ggplot's transparent background changes after ShinyApp resizing
body: <p>The following code shows 2 <code>ggplot2</code>-plots in a <code>shinydashboard</code>. The plot backgrounds should always be <strong>transparent</strong>, even <strong>after resizing</strong>.</p>
  
  <p>The plots show correctly when starting the app, but as soon as the screen is resized, or the siderbar closed, the background changes to white again. <em>Why is that and how can I prevent that?</em>  </p>
  
  <p>When closing the sidebar, the background changes to white and after reopening the sidebar, the plots switch to transparent again.
  But when resizing the window, its not changing back to transparent no matter what. Except maybe you resize exactly to the default window dimensions. I didnt manage to test that ;)</p>
  
  <p>This occurs in RStudio and browser (Chrome, Firefox).</p>
  
  <p>I know that an option would be to change the background color of the ggplots to the background color of the ShinyApp. But I hope its not the only.</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  library(ggplot2)
  
  df &lt;- data.frame(
    id = rep(1:5, each=5),
    a = runif(25, 2, 50)
  )
  
  ui = {dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
      splitLayout(cellWidths = c("50%", "50%"), 
                  plotOutput("boxplot"),
                  plotOutput("vioplot")
      )
    )
  )}
  
  server &lt;- function(input, output) {
    output$boxplot &lt;- renderPlot({
      ggplot(df, aes(x=id, y=a, group=id)) + 
        geom_boxplot(aes(fill=id)) +
        facet_grid(~id, margins = T) +
        theme(rect=element_blank(),
              panel.grid = element_blank(),
              panel.background= element_blank(),
              plot.background = element_blank()
        )
    }, bg="transparent")
  
    output$vioplot &lt;- renderPlot({
      ggplot(df, aes(x=id, y=a, group=id)) + 
        geom_violin(aes(fill=factor(id))) +
        facet_grid(~id, margins = T) +
        theme(rect=element_blank(),
              panel.grid = element_blank(),
              panel.background= element_blank(),
              plot.background = element_blank()
        )
    }, bg="transparent")
  }
  
  shinyApp(ui, server)
  </code></pre>