wilkelab/cowplot

Rstudio crashed on iOS saving plots into tiff format

Closed this issue · 6 comments

This issue first occured when I tried to make plots from Seurat package. A detailed description can be found through this issue.

Briefly, using ggsave or save_plot to save ggplots with tiff device instantly caused crash of Rstudio. If the ggplot is generated with plain ggplot() functions, it won't cause any crash. Crash only happens when cowplot was involved.

Saving to other devices (i.e. svg, eps, jpeg, png) does not trigger the crash.

This only occured on iOS (Catalina 10.15.7). Swithing to Ubuntu everything worked fine.

I've got the very same problem on Windows 10.

Edit: Not RStudio itself crashes, but the R session aborts with a fatal error.

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] RColorBrewer_1.1-2 cowplot_1.1.1      jmvReadWrite_0.2.2 forcats_0.5.1      stringr_1.4.0      dplyr_1.0.7       
 [7] purrr_0.3.4        readr_2.1.0        tidyr_1.1.4        tibble_3.1.6       ggplot2_3.3.5      tidyverse_1.3.1   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7       cellranger_1.1.0 pillar_1.6.4     compiler_4.1.1   dbplyr_2.1.1     tools_4.1.1      jsonlite_1.7.2  
 [8] lubridate_1.8.0  lifecycle_1.0.1  gtable_0.3.0     pkgconfig_2.0.3  rlang_0.4.12     reprex_2.0.1     cli_3.1.0       
[15] rstudioapi_0.13  DBI_1.1.1        haven_2.4.3      xml2_1.3.2       withr_2.4.2      httr_1.4.2       fs_1.5.0        
[22] generics_0.1.1   vctrs_0.3.8      hms_1.1.1        grid_4.1.1       tidyselect_1.1.1 glue_1.5.0       R6_2.5.1        
[29] fansi_0.5.0      readxl_1.3.1     tzdb_0.2.0       modelr_0.1.8     magrittr_2.0.1   backports_1.3.0  scales_1.1.1    
[36] ellipsis_0.3.2   rvest_1.0.2      assertthat_0.2.1 colorspace_2.0-2 utf8_1.2.2       stringi_1.7.5    munsell_0.5.0   
[43] broom_0.7.10     crayon_1.4.2    

Maybe related to these issues?

tidyverse/ggplot2#4680
r-lib/ragg#97

Workaround: Don't use tiff.

Ok, thanks! Will not use tiff.

@wibeasley 's suggestion of using grDevice::tiff as a workaround worked!

satijalab/seurat#5304

Workaround: Don't use tiff.

Normally we don't, but the publisher had a strong preference.

Normally we don't, but the publisher had a strong preference.

You could always save to png and then convert using some other software. grDevices::tiff() is fine in principle, but it doesn't have as much support for more advanced features, in particular system fonts, so we're generally recommending the agg devices as default. It's unfortunate that agg_tiff() crashes.