The example below plots 4 groups in 4 panes together. But the problem is that they seem to be residing in a single grid. Is it possible to control the size of the charts in shiny output? (ie so that there is no scroll bar on the right when the app is run) I tried to control the height and width, but that only seems to control the image within the grid itself... any ideas?
thanks
shinyUI(pageWithSidebar(
headerPanel("Example"),
sidebarPanel(
),
mainPanel(
tabsetPanel(tabPanel("Main",plotOutput("temp"))
)#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))
}, height = 1000, width = 1000)
})
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))
})
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With