ggplot: remove white outline from text

I'm trying to make a plot in Shiny and I want it to be with transparent background. However, when I remove the background there is appears a white outline around all text (title and axis labels in the reprex). How can I get rid of it?

P.S. When I just make a plot (not in Shiny app) and set plot.background = element_rect(fill = "red") where is no such outline (in the RStudio plot tab).

plot

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(ggplot2)

# Define UI for application that draws a histogram
ui <- shinydashboardPlus::dashboardPage(

    # Application title
    header = shinydashboardPlus::dashboardHeader(title = "Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
    sidebar = shinydashboardPlus::dashboardSidebar(),
    body = shinydashboard::dashboardBody(
        fluidRow(
            
            shinydashboardPlus::box(
                title = "Plot",
                background = "red",
                plotOutput(outputId = "pubs_pl")
            )
        )
    )

)

# Define server logic required to draw a histogram
server <- function(input, output) {

    output$pubs_pl <- renderPlot({
        ggplot(data = data.frame(x = rnorm(10),
                                          y = rnorm(10)),
                        ggplot2::aes(x = x, y = y))+
            labs(title = "Title")+
            geom_point()+
            theme_void()+
            theme(axis.text.x = element_text(size = 15))}, bg="transparent")
    
    

}

# Run the application 
shinyApp(ui = ui, server = server)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.