Setting renderPlot height not changing FluidRow height

I am trying to let the user change the height and width of a plot with two numericInputs, like this

 output$plot_preview <- renderPlot({
        return(the_plot())
    }
    , width = function() as.numeric(input$plot_width)
    , height = function() as.numeric(input$plot_height)
    )

However, this value is not used when Shiny sets the height of the fluidRow that contains the plotOutput. The rows after the plot will not change position and will appear over the top of the plotOutput.

, tabPanel(title = "Plot Preview"
            , fluidRow( plotOutput('plot_preview'))
            , fluidRow(column(4
                , imageOutput('trend_badge')
            )
            , column(4
                , imageOutput('alarm_badge')
            )
            , column(4
                , imageOutput('goal_badge')
            )
            )
        )

Shouldn't the fluidRow change its height based on the output plot and the following row move down?
Do I need to manually force a refresh of some kind, or is this just not how fluidRows work?

Sorry for the lack of a reprex, I will create one and update this post with it later if it is needed.

Hi @BassEngD. In ui, you have to set the plotOutput("plot_preview", width = "auto", height = "auto") and no need to within fluidRow. And in server, the renderPlot should be within observe in order to evaluate the numericInput.

observe({
  output$plot_preview <- renderPlot(the_plot(), 
                                    width = input$plot_width, 
                                    height = input$plot_height)
})
1 Like

That worked wonderfully. Thank you very much for the help. :grinning:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.