Rstudio plot output issues

How to define custom column heights based on a specific condition?

y<-textOutput("winsize"),
if(y=="All"){
plotOutput("chr_plot",height=3000)}
else{
  plotOutput("chr_plot",height=500)
  
}

I tired using this but this is not working

One option that might work for you is to control the plotOutput height in the server code.

library(shiny)

ui <- fluidPage(
  
  titlePanel("Mock App"),
  sidebarLayout(
    sidebarPanel(
      checkboxInput("ChkBox", "Check for Big Plot")
    ),
    mainPanel(
      plotOutput("Plot1")
    )
  )
) #Close FluidPage

server <- function(input, output) {
  observe({
    if (input$ChkBox) H = 600 else H = 400
    output$Plot1 <- renderPlot({
      plot(seq(0,10), seq(100, 110), col = "red")
    }, height = H)
    
  })
}

# Run the application 
shinyApp(ui = ui, server = server)
1 Like

Thanks this actually works !!

Now the issue I'm having is that well panel is not syncing with the dynamic plot height.

If you are referring to the well panel in the side bar, I would not expect it to change size depending on the plot in the main panel and I cannot think of a simple way to do that at the moment. Is that what you want?

1 Like

I simply got rid of the wellPanel() so now it is only applied on the heading, by this the overall plot looks neat.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.