So I am reaching out to this community as I have been unsuccessful in asking this question on stackoverflow.
I would like to have one plot be "two plots tall" in height when the screen is wide, but then collapse to the same height when displayed on smaller devices. Is there no way to accomplish this "natively" with fluidRow
+ column
and/or fillRow
+ fillCol
? Do I have to revert to css @media queries?
My original "solution" on stackoverflow resorts to specifying fixed "heights" but this results in a loss of responsiveness.
I can make things a little more dynamic by leveraging client data (see below) but I lose the ability to "shrink the height of the larger plot" once I reduce the screen size (think mobile device).
library(shiny)
# QUESTION: How to responsively shrink height of "plotLeft" when
# the screen size is small?
ui <- fluidPage(
fluidRow(
column(6, plotOutput("plotLeft")),
column(6, plotOutput("plotTopRight"), plotOutput("plotBottomRight"))
)
)
server <- function(input, output, session) {
cdata <- session$clientData
output$plotLeft <- renderPlot(
plot(cars),
height = function() {
cdata$output_plotTopRight_height + cdata$output_plotBottomRight_height
}
)
output$plotTopRight <- renderPlot(plot(pressure))
output$plotBottomRight <- renderPlot(plot(AirPassengers))
}
shinyApp(ui, server)