Warning: Error in ggplot2::geom_boxplot: Problem while converting geom to grob.
System details
Browser Version: Google Chrome Version 124.0.6367.62
Output of sessionInfo():
# sessionInfo() output goes here
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=Romanian_Romania.1252 LC_CTYPE=Romanian_Romania.1252 LC_MONETARY=Romanian_Romania.1252 LC_NUMERIC=C
[5] LC_TIME=Romanian_Romania.1252
time zone: Europe/Bucharest
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rlang_1.1.3 shiny_1.8.1.1
loaded via a namespace (and not attached):
[1] gtable_0.3.4 jsonlite_1.8.8 dplyr_1.1.4 compiler_4.3.3 crayon_1.5.2 promises_1.2.1 tidyselect_1.2.1 Rcpp_1.0.12
[9] unigd_0.1.1 later_1.3.2 jquerylib_0.1.4 systemfonts_1.0.6 scales_1.3.0 textshaping_0.3.7 fastmap_1.1.1 mime_0.12
[17] ggplot2_3.5.1 R6_2.5.1 labeling_0.4.3 generics_0.1.3 tibble_3.2.1 munsell_0.5.1 bslib_0.7.0 pillar_1.9.0
[25] utf8_1.2.4 cachem_1.0.8 httpuv_1.6.15 sass_0.4.9 memoise_2.0.1 cli_3.6.2 withr_3.0.0 magrittr_2.0.3
[33] digest_0.6.35 grid_4.3.3 xtable_1.8-4 lifecycle_1.0.4 vctrs_0.6.5 glue_1.7.0 farver_2.1.1 ragg_1.3.0
[41] httpgd_2.0.1 fansi_1.0.6 colorspace_2.1-0 tools_4.3.3 pkgconfig_2.0.3 htmltools_0.5.8
Example application or steps to reproduce the problem
library(shiny)
# Minimal, self-contained example app code goes here
ui <- shiny::fluidPage(
shiny::h1("Test"),
shiny::plotOutput("boxplot")
)
server <- function(input, output, session) {
output$boxplot <- shiny::renderPlot({
df <- data.frame(timepoint = rep("tp0", 100), gene_expression = runif(100))
ggplot2::ggplot(
data = df,
ggplot2::aes(
x = timepoint,
y = gene_expression)
) + ggplot2::geom_boxplot()
})
}
Describe the problem in detail
Hello! I am encountering some issues in generating shiny apps that contain boxplots created by ggplot2. By running the example provided above, I get the following error:
Warning: Error in ggplot2::geom_boxplot: Problem while converting geom to grob.
i Error occurred in the 1st layer.
Caused by error:
! C stack usage 1916488 is too close to the limit
185: <Anonymous>
184: signalCondition
183: signal_abort
182: rlang::abort
181: cli::cli_abort
180: value[[3L]]
179: tryCatchOne
178: tryCatchList
177: tryCatch
176: try_fetch
175: by_layer
174: ggplot_gtable.ggplot_built
172: print.ggplot
167: func
165: f
164: Reduce
155: do
154: hybrid_chain
126: drawPlot
112: <reactive:plotObj>
96: drawReactive
83: renderFunc
82: output$boxplot
1: shiny::runApp
Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be tra.
When I run the traceback() function, I get the following output
11: execCallbacks(timeoutSecs, all, loop$id)
10: run_now(timeoutMs/1000, all = FALSE)
9: service(timeout)
8: serviceApp()
7: ..stacktracefloor..(serviceApp())
6: withCallingHandlers(expr, error = doCaptureStack)
5: domain$wrapSync(expr)
4: promises::with_promise_domain(createStackTracePromiseDomain(),
expr)
3: captureStackTraces({
while (!.globals$stopped) {
..stacktracefloor..(serviceApp())
}
})
2: ..stacktraceoff..(captureStackTraces({
while (!.globals$stopped) {
..stacktracefloor..(serviceApp())
}
}))
1: shiny::runApp("shiny_apps//dummy_tests/")
I should mention that this error occurs only on Windows, if I switch to linux, the app works just fine. Also, if I change geom_boxplot with geom_violin, the error disappears.
The plot-generating code works just fine outside the shiny reactive context.
Any help to solve this issue would be very much appreciated! Thank you!!
Experiencing the same issue, in Windows 11. I would appreciate any help with this issue. The versions of the packages I have are:
[1] "ggplot2 version: 4.0.0"
[1] "shiny version: 1.11.1"
I was able to successfully run this app locally
ui <- shiny::fluidPage(
shiny::h1("Test"),
shiny::plotOutput("boxplot")
)
server <- function(input, output, session) {
output$boxplot <- shiny::renderPlot({
df <- data.frame(timepoint = rep("tp0", 100), gene_expression = runif(100))
ggplot2::ggplot(
data = df,
ggplot2::aes(
x = timepoint,
y = gene_expression)
) + ggplot2::geom_boxplot()
})
}
shiny::shinyApp(ui = ui, server = server)
on a windows 11 machine
sessionInfo() yields
> sessionInfo()
R version 4.5.1 (2025-06-13 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)
Matrix products: default
LAPACK version 3.12.1
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: Asia/Calcutta
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] shiny_1.11.1
loaded via a namespace (and not attached):
[1] vctrs_0.6.5 cli_3.6.5 rlang_1.1.6
[4] promises_1.3.3 S7_0.2.0 jsonlite_2.0.0
[7] xtable_1.8-4 labeling_0.4.3 glue_1.8.0
[10] htmltools_0.5.8.1 httpuv_1.6.16 sass_0.4.10
[13] scales_1.4.0 grid_4.5.1 jquerylib_0.1.4
[16] fastmap_1.2.0 lifecycle_1.0.4 memoise_2.0.1
[19] compiler_4.5.1 RColorBrewer_1.1-3 Rcpp_1.1.0
[22] later_1.4.4 farver_2.1.2 digest_0.6.37
[25] R6_2.6.1 magrittr_2.0.4 bslib_0.9.0
[28] tools_4.5.1 withr_3.0.2 gtable_0.3.6
[31] mime_0.13 ggplot2_4.0.0 cachem_1.1.0
Is there anything I am missing to reproduce this issue?