Josep Pueyo
Josep Pueyo

Reputation: 781

Ggplot size in shinyR apps

I developed a shiny app that renders several plots using ggplot. However, the rendered plots are not taking the max width of the main panel and I can't figure it out how to adjust the size of ggplot to maximise its visualization.

The app can be visualized here: https://icra.shinyapps.io/nbs-list/

The code can be found here: https://github.com/icra/nbs_list/

(I didn't copy paste because it's 452 lines length).

Thank you.

Upvotes: 0

Views: 383

Answers (1)

YBS
YBS

Reputation: 21349

Try this in your ui

             #if top NBS is selected
               conditionalPanel(condition = "input.top_custom.includes('top_NBS')",
                                plotOutput("plot_top", height="700px")
               ),
               
               #if custom NBS is selected
               conditionalPanel(condition = "input.top_custom.includes('custom_NBS')",
                                plotOutput("plot_facet", height="700px")
               )

It works for me. With 700px, it gives the following output

output1

Regardless of the size, some of the blank space above the plot needs to be deleted. With 400px it gives the following ouput:

output2

Upvotes: 1

Related Questions