Description
Describe the problem
I'm trying to make a set of ggplot
's to dynamically fill the height of the browser.
This minimal example works :
library(shiny)
library(bslib)
#>
#> Attaching package: 'bslib'
#> The following object is masked from 'package:utils':
#>
#> page
library(ggplot2)
# A simple ggplot
plot_gg <- function(title) {
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
ggtitle(title)
}
ui <- page_fillable(
layout_sidebar(
fill = TRUE,
layout_column_wrap(
width = 1,
fill = TRUE,
height = "100%",
layout_column_wrap(
width = 1 / 2,
fill = TRUE,
height = "50%",
card(
plotOutput("plot1")
),
card(
plotOutput("plot2")
)
),
card(
height = "50%",
plotOutput("plot3")
)
)
)
)
server <- function(input, output, session) {
output$plot1 <- renderPlot({
plot_gg("Plot 1")
})
output$plot2 <- renderPlot({
plot_gg("Plot 2")
})
output$plot3 <- renderPlot({
plot_gg("Plot 3")
})
}
shinyApp(ui, server)
Created on 2025-04-28 with reprex v2.1.1
But this one doesn't. The only difference is that this one has a navset_tab
plus a nav_panel
.
library(shiny)
library(bslib)
#>
#> Attaching package: 'bslib'
#> The following object is masked from 'package:utils':
#>
#> page
library(ggplot2)
# A simple ggplot
plot_gg <- function(title) {
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
ggtitle(title)
}
ui <- page_fillable(
layout_sidebar(
navset_tab(
nav_panel(
'test',
fill = TRUE,
layout_column_wrap(
width = 1,
fill = TRUE,
height = "100%",
layout_column_wrap(
width = 1 / 2,
fill = TRUE,
height = "50%",
card(
plotOutput("plot1")
),
card(
plotOutput("plot2")
)
),
card(
height = "50%",
plotOutput("plot3")
)
)
)
)
)
)
server <- function(input, output, session) {
output$plot1 <- renderPlot({
plot_gg("Plot 1")
})
output$plot2 <- renderPlot({
plot_gg("Plot 2")
})
output$plot3 <- renderPlot({
plot_gg("Plot 3")
})
}
shinyApp(ui, server)
Created on 2025-04-28 with reprex v2.1.1
Session Info
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.5.0 (2025-04-11)
os Ubuntu 24.04.2 LTS
system x86_64, linux-gnu
ui RStudio
language (EN)
collate C.UTF-8
ctype C.UTF-8
tz Europe/Brussels
date 2025-04-28
rstudio 2025.04.0-daily+401 Mariposa Orchid (desktop)
pandoc 3.4 @ /usr/lib/rstudio/resources/app/bin/quarto/bin/tools/x86_64/ (via rmarkdown)
quarto 1.6.42 @ /usr/lib/rstudio/resources/app/bin/quarto/bin/quarto
─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
P bsicons 0.1.2 2023-11-04 [?] CRAN (R 4.5.0)
VP bslib * 0.9.0 2025-04-28 [?] Github (rstudio/bslib@7cf8050) (on disk 0.9.0.9000)
P cachem 1.1.0 2024-05-16 [?] CRAN (R 4.5.0)
P callr 3.7.6 2024-03-25 [?] CRAN (R 4.5.0)
P cli 3.6.5 2025-04-23 [?] CRAN (R 4.5.0)
P clipr 0.8.0 2022-02-22 [?] CRAN (R 4.5.0)
P curl 6.2.2 2025-03-24 [?] CRAN (R 4.5.0)
P desc 1.4.3 2023-12-10 [?] CRAN (R 4.5.0)
P devtools 2.4.5 2022-10-11 [?] CRAN (R 4.5.0)
P digest 0.6.37 2024-08-19 [?] CRAN (R 4.5.0)
P dplyr 1.1.4 2023-11-17 [?] CRAN (R 4.5.0)
P ellipsis 0.3.2 2021-04-29 [?] CRAN (R 4.5.0)
P evaluate 1.0.3 2025-01-10 [?] CRAN (R 4.5.0)
P farver 2.1.2 2024-05-13 [?] CRAN (R 4.5.0)
P fastmap 1.2.0 2024-05-15 [?] CRAN (R 4.5.0)
fs 1.6.6 2025-04-12 [1] CRAN (R 4.5.0)
P generics 0.1.3 2022-07-05 [?] CRAN (R 4.5.0)
P ggplot2 * 3.5.2 2025-04-09 [?] CRAN (R 4.5.0)
P glue 1.8.0 2024-09-30 [?] CRAN (R 4.5.0)
P gtable 0.3.6 2024-10-25 [?] CRAN (R 4.5.0)
P htmltools 0.5.8.1 2024-04-04 [?] CRAN (R 4.5.0)
P htmlwidgets 1.6.4 2023-12-06 [?] CRAN (R 4.5.0)
P httpuv 1.6.16 2025-04-16 [?] CRAN (R 4.5.0)
P jquerylib 0.1.4 2021-04-26 [?] CRAN (R 4.5.0)
P jsonlite 2.0.0 2025-03-27 [?] CRAN (R 4.5.0)
P knitr 1.50 2025-03-16 [?] RSPM (R 4.5.0)
P labeling 0.4.3 2023-08-29 [?] CRAN (R 4.5.0)
P later 1.4.2 2025-04-08 [?] CRAN (R 4.5.0)
P lifecycle 1.0.4 2023-11-07 [?] CRAN (R 4.5.0)
P magrittr 2.0.3 2022-03-30 [?] CRAN (R 4.5.0)
P memoise 2.0.1 2021-11-26 [?] CRAN (R 4.5.0)
P mime 0.13 2025-03-17 [?] CRAN (R 4.5.0)
P miniUI 0.1.2 2025-04-17 [?] CRAN (R 4.5.0)
P pillar 1.10.2 2025-04-05 [?] CRAN (R 4.5.0)
P pkgbuild 1.4.7 2025-03-24 [?] CRAN (R 4.5.0)
P pkgconfig 2.0.3 2019-09-22 [?] CRAN (R 4.5.0)
P pkgload 1.4.0 2024-06-28 [?] CRAN (R 4.5.0)
P processx 3.8.6 2025-02-21 [?] CRAN (R 4.5.0)
P profvis 0.4.0 2024-09-20 [?] CRAN (R 4.5.0)
P promises 1.3.2 2024-11-28 [?] CRAN (R 4.5.0)
P ps 1.9.1 2025-04-12 [?] CRAN (R 4.5.0)
P purrr 1.0.4 2025-02-05 [?] CRAN (R 4.5.0)
P R6 2.6.1 2025-02-15 [?] CRAN (R 4.5.0)
P ragg 1.4.0 2025-04-10 [?] CRAN (R 4.5.0)
P RColorBrewer 1.1-3 2022-04-03 [?] CRAN (R 4.5.0)
P Rcpp 1.0.14 2025-01-12 [?] CRAN (R 4.5.0)
P remotes 2.5.0 2024-03-17 [?] CRAN (R 4.5.0)
renv 1.1.4 2025-03-20 [1] CRAN (R 4.5.0)
P reprex * 2.1.1 2024-07-06 [?] CRAN (R 4.5.0)
rlang 1.1.6 2025-04-11 [1] CRAN (R 4.5.0)
P rmarkdown 2.29 2024-11-04 [?] CRAN (R 4.5.0)
P rstudioapi 0.17.1 2024-10-22 [?] CRAN (R 4.5.0)
sass 0.4.10 2025-04-11 [1] CRAN (R 4.5.0)
P scales 1.4.0 2025-04-24 [?] CRAN (R 4.5.0)
P sessioninfo 1.2.3 2025-02-05 [?] CRAN (R 4.5.0)
P shiny * 1.10.0 2024-12-14 [?] CRAN (R 4.5.0)
P systemfonts 1.2.2 2025-04-04 [?] CRAN (R 4.5.0)
P textshaping 1.0.0 2025-01-20 [?] CRAN (R 4.5.0)
P tibble 3.2.1 2023-03-20 [?] CRAN (R 4.5.0)
P tidyselect 1.2.1 2024-03-11 [?] CRAN (R 4.5.0)
P urlchecker 1.0.1 2021-11-30 [?] CRAN (R 4.5.0)
P usethis 3.1.0 2024-11-26 [?] CRAN (R 4.5.0)
P vctrs 0.6.5 2023-12-01 [?] CRAN (R 4.5.0)
P withr 3.0.2 2024-10-28 [?] CRAN (R 4.5.0)
P xfun 0.52 2025-04-02 [?] CRAN (R 4.5.0)
P xtable 1.8-4 2019-04-21 [?] CRAN (R 4.5.0)
P yaml 2.3.10 2024-07-26 [?] CRAN (R 4.5.0)
[1] /home/zenofl01/.cache/R/renv/library/cpepe-app-d912f9eb/linux-ubuntu-noble/R-4.5/x86_64-pc-linux-gnu
[2] /home/zenofl01/.cache/R/renv/sandbox/linux-ubuntu-noble/R-4.5/x86_64-pc-linux-gnu/9a444a72
── Packages attached to the search path.
V ── Loaded and on-disk version mismatch.
P ── Loaded and on-disk path mismatch.