plotOutput
has height and width parameters as well; the width defaults to "100%"
(meaning 100% of the available width in its container) and the height defaults to "400px"
(400 pixels). Try experimenting with these values, changing them to either "auto"
or "1000px"
.
renderPlot
's height and width parameters control the size of the generated image file in pixels, but doesn't directly affect the rendered size in the web page. Their default values are both "auto"
, which means, detect and use the width/height of the corresponding plotOutput
. So once you've set the width and height on plotOutput
, you generally don't need the width and height to be set on renderPlot
at all.
shinyUI(pageWithSidebar(
headerPanel("Example"),
sidebarPanel(
),
mainPanel(
tabsetPanel(tabPanel("Main",plotOutput("temp", height = 1000, width = 1000))
)#tabsetPanel
)#mainPane;
))
shinyServer(function(input, output) {
output$temp <-renderPlot({
par(mfrow=c(2,2))
plot(1:10)
plot(rnorm(10))
plot(rnorm(10))
plot(rnorm(10))
})
})
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…