statebins
statebins copied to clipboard
Removing Unwanted Whitespace
Following up from Twitter; how to get rid of the white background at the edges that resists all my attempts at removing them?
library(shinydashboard)
library(ggplot2)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(fluidPage(fluidRow(
plotOutput("statebins1")),
fluidRow(
plotOutput("statebins2"))
))
)
server <- function(input, output) {
output$statebins1 <- renderPlot({
us.data <- data.frame(cbind(state.abb, state.area), stringsAsFactors = FALSE)
us.data$state.area <- as.numeric(us.data$state.area)
statebins::statebins(state_data = us.data, state_col = "state.abb", value_col = "state.area")
})
output$statebins2 <- renderPlot({
statebins::statebins(state_data = us.data, state_col = "state.abb", value_col = "state.area") +
theme(axis.text.x = element_blank(), axis.text.y = element_blank(), axis.ticks =
element_blank(), panel.grid.minor = element_blank(), panel.grid.major = element_blank(),
plot.background = element_rect(fill = "#ecf0f5"))
})
}
shinyApp(ui, server)