[英]Scale ggplot output in Shiny app
plotOutput
可以使用plotOutput
的width
参数。 然后,您可以将输出包装在具有中心对齐的div
。
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)
}
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.