Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Error in ggplot2::geom_boxplot: Problem while converting geom to grob. #4034

Open
AndiMunteanu opened this issue Apr 25, 2024 · 0 comments

Comments

@AndiMunteanu
Copy link

AndiMunteanu commented Apr 25, 2024

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

# 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!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant