Reputation: 124
I'm having trouble shrinking my plotOutput. All I want to do is slightly shrink the ggplot so there is a little padding in the box.
This is the image I have:
This is the image that I want:
The difference is subtle, but basically I just want to shrink the graph.
Upvotes: 0
Views: 685
Reputation: 7655
The width
argument in plotOutput
can be used for that purpose. Then you can wrap the output in a div
with central alignment.
library(ggplot2)
library(shiny)
gg <- ggplot(mtcars, aes(wt, mpg)) + geom_point() +
theme(panel.background = element_rect(fill = 'grey'))
shinyApp(
fluidPage(
plotOutput('plot1'),
div(
plotOutput('plot2'),
style = "padding-right: 10%; padding-left: 10%"
)
),
function(input, output, session){
output$plot1 <- renderPlot(gg)
output$plot2 <- renderPlot(gg)
}
)
Upvotes: 1