0

I am trying to place the plots i have made using plot_ly in R in my dashboard. I am using the fluidRow() structure, and have great trouble trying to make my plots fill out the screen. As i understand the screen is divided into 12 parts, so i should with the following code have three rows, the first one containing two plots of equal size: 6, the second containing 3 plots of equal size: 4, and a third row containing a plot of size 8,and an ui output of size 4. Here is the code for my whole ui:

ui <- fluidPage(
  
  titlePanel("Dashboard"),
  
  mainPanel(
    selectInput("select", label = h3("Quality Indicator"), 
                choices = list(
                  "discharge_any_anticoagulant" = "af_p_dis_anticoag",
                  "discharge_any_antiplatelet" = "isp_dis_antiplat",
                  "door_to_groin" = "door_to_groin",
                  "door_to_needle" = "door_to_needle",
                  "dysphagia_screening_type" = "p_dys_screen",
                  "thrombolysis" = "rec_total_is",
                  "hospitalized_in" = "sp_hosp_stroke_unit_ICU"
                ), 
                selected = "af_p_dis_anticoag"),
    
    fluidRow(
      column(6,plotlyOutput("QIplot", width = "100%", height = "100%")),
      column(6,plotlyOutput("barplotStroke", width = "100%", height = "100%"))
      ),
    
    fluidRow(
      column(4,plotlyOutput("barplotGender",width = "100%", height = "100%")),
      column(4,plotlyOutput("barplotImage",width = "100%", height = "100%")),
      column(4,plotlyOutput("barplotPrenotification",width = "100%", height = "100%"))
    ),
    
    fluidRow(
      column(8,plotlyOutput("awardCountPlot",width = "100%", height = "100%")),
      column(4,uiOutput("award_info",width = "100%", height = "100%"))
    ),
  )
)

As shown in the picture below, it doesn't seem to work: Screenshot of the whole screen (only the first two fluidRows are visible)
This is the code for one of the plots:

    plot_ly(orientation = 'h') %>%
      add_trace(data = data_list$data_all, 
                y = ~subGroupVal, x = ~Value, 
                type = 'bar', 
                name = 'Country Average 2022', 
                marker = list(color = 'lightgray')) %>%
      add_trace(data = data_list$data_2022, 
                y = ~subGroupVal, 
                x = ~Value, 
                type = 'bar', 
                name = 'General 2022', 
                marker = list(color = 'lightblue')) %>%
      add_trace(data = data_list$data_2021, 
                y = ~subGroupVal, 
                x = ~Value, 
                type = 'bar', 
                name = 'General 2021', 
                marker = list(color = 'orange')) %>%
      layout(title = paste(title_mapping[[input$select]], "Stroke Types", sep = " - "),
             yaxis = list(title = FALSE),
             xaxis = list(title = FALSE),
             showlegend = TRUE,
             hovermode = "false",
             barmode = 'group',
             autosize = TRUE,
             width = "100%")```


I hope one of you can help.  
  • The default width of `mainPanel` is 8 or 2/3 of the screen. If you want the entire page width, either define `mainPanel(width = 12...` (and the rest) or remove `mainPanel` altogether. Just add the `fluidRow`s after `titlePanel`. It looks like you're new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. Including sample data like the output from `dput()` or `reprex::reprex()` to render a minimally reproducible example. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Jun 26 '23 at 14:37

0 Answers0