Shiny - align plots axis

北城以北 提交于 2019-12-11 04:44:23

问题


I have a shiny app that have 2 bar charts and one heat chart, they have the same x axis (year), I want the years to be aligned in all the plots, but I don't know how to do it. below is my UI code:

ui = fluidPage(
        titlePanel("Global Terrorism, is it getting worse?"),
            tabsetPanel(
                 tabPanel("Plot", fluid = TRUE,
               sidebarLayout(
                 sidebarPanel(radioButtons(
                        inputId="radio",
                            label="Variable Selection Type:",
                             choices=list(
                              "All Countries",
                              "Select a Country"
                              ),
                         selected="All Countries")


                    ,conditionalPanel(
                        condition = "input.radio != 'All Countries'",
                        selectInput("Country", "Select Country", choices = sort(unique(mydat$Country)), selected = "Iraq"),
                        sliderInput("freq", "Minimum Frequency:",min = 1,  max = 50, value = 15),
                            sliderInput("max", "Maximum Number of Words:", min = 1,  max = 100,  value = 100)
                    ), width=2),

        mainPanel(fluidRow(
            column(8,  plotlyOutput("trendbarPlot", height = "200px",width = 845)),
            column(8,  plotlyOutput("trendheatrPlot", height = "300px",width = 845)),
            column(2,  plotOutput("WordCloud", height = "200px",width = 400)),          
            column(8, plotlyOutput("trendstakbarPlot", height = "200px",width = 895))  
                 )
                 )



               )
      ),
      tabPanel("Map", fluid = TRUE,
               sidebarLayout(
                 sidebarPanel(sliderInput("year", "Select Year:", min = 1968, max = 2009, value = 2009, sep='')),

        mainPanel(
                   htmlOutput("Attacks")
                 )


               )
      )
    )

来源:https://stackoverflow.com/questions/44341494/shiny-align-plots-axis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!