Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R shiny plot layout UI

Tags:

r

shiny

Quick question on formatting positions of plots in r Shiny UI.

So far I have made a series of histogram plots in Server.R and they all show perfectly in the UI. The only problem is, is that I want them to line up in 2 rows, 4 to a row. My current code, pasted below, gives me 3 rows! The top one with 4 graphs, the second with 3 graphs (With room to fit a fourth) and then the last row has 1 plot... Where have I gone wrong and is there a better method to layout 8 plots in shiny?

fluidRow(
   column(12,
       "",
       fluidRow(
         column(3,
                plotOutput("PlotHy")#,

         ),
         column(width = 3,
                plotOutput("PlotMe")),
         column(width = 3,
                plotOutput("PlotEthane")),
         column(width = 3,
                plotOutput("PlotEthylene")),
         column(width = 3,
                plotOutput("PlotCO")),
         column(width = 3,
                plotOutput("PlotCO2")),
         column(width = 3,
                plotOutput("PlotO")),
         column(width = 3,
                plotOutput("PlotN"))
       )
)
),

Thanks, James

like image 836
James Willcox Avatar asked Jan 18 '26 22:01

James Willcox


1 Answers

Just explicit the row separation:

shinyUI(
    fluidPage(

    titlePanel("stack overflow question"),

    fluidRow(
    column(12,
           "",
           fluidRow(
               column(3,
                      plotOutput("PlotHy")),
               column(width = 3,
                      plotOutput("PlotMe")),
               column(width = 3,
                      plotOutput("PlotEthane")),
               column(width = 3,
                      plotOutput("PlotEthylene"))
           ), fluidRow(
               column(width = 3,
                      plotOutput("PlotCO")),
               column(width = 3,
                      plotOutput("PlotCO2")),
               column(width = 3,
                      plotOutput("PlotO")),
               column(width = 3,
                      plotOutput("PlotN"))
           )
    )
)
))
like image 199
momobo Avatar answered Jan 20 '26 15:01

momobo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!