0
我在收縮plotOutput時遇到問題。我想要做的只是稍微收縮ggplot,因此盒子裏有一點填充。在Shiny應用中縮放ggplot輸出
這是我的形象:
這是我想要的形象:
的區別是微妙的,但基本上我只想縮小圖形。
我在收縮plotOutput時遇到問題。我想要做的只是稍微收縮ggplot,因此盒子裏有一點填充。在Shiny應用中縮放ggplot輸出
這是我的形象:
這是我想要的形象:
的區別是微妙的,但基本上我只想縮小圖形。
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)
}
)
這不是我想縮小的整個面板,只是ggplot – Tarzan
也許[這](https://stackoverflow.com/questions/17838709/scale-and-size-of-plot-in-rstudio-shiny)可以幫助 – akrun
是的,我看到了這,但它並沒有給我我想要的:/ – Tarzan