Centering a plot within a fluidRow in Shiny

前端 未结 2 760
谎友^
谎友^ 2021-02-05 03:58

I have a fluidRow with a plot rendered in one of the columns. I would like to know how to center the plot when I have manually specified the plot width via the renderPlot({crea

2条回答
  •  梦如初夏
    2021-02-05 04:51

    You could use align="center" as part of your plotOutput() function. So your ui.R would like this:

    ui.R

    setwd("C:/Users/Nate/Documents/R Working Directory/appFolder/example")
    shinyUI(fluidPage(
    titlePanel("Test"),
    sidebarLayout(
    sidebarPanel(
    p('stuff here')
      ),
    mainPanel(
    tabsetPanel(id = 'tabs1',
              tabPanel("main",
                       fluidRow(
                         column(8,
                                plotOutput('plot1',align="center")),
                         column(4,
                                p('2nd column'))),
                       fluidRow(
                       p("2nd row of viewing area"))
                       ),
    
              tabPanel("second",
                   p("main viewing area")),
          tabPanel("third",
                          p('main viewing area')
                       )
    ))
    )
    ))
    

提交回复
热议问题