Skip to content

ragg device functions not working with ggsave #4347

@PaulC91

Description

@PaulC91

In the recent tidyverse blogpost "Modern Text Features in R" it states you can use the ragg device functions with ggsave:

You can use ragg with ggsave() by passing the device function to the device argument (e.g. ggsave(device = agg_tiff)).

It's not working for me however, the following code results in an empty image being saved.

Related to r-lib/ragg#69

library(ggplot2)
library(ragg)

p <- ggplot(iris, aes(Sepal.Length, Sepal.Width, col = Species)) + geom_point() 

ggsave("gg_test.png", p, device = agg_png) 
#> Saving 7 x 5 in image

Created on 2021-02-17 by the reprex package (v1.0.0)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.0.3 (2020-10-10)
#>  os       macOS Mojave 10.14.6        
#>  system   x86_64, darwin17.0          
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_GB.UTF-8                 
#>  ctype    en_GB.UTF-8                 
#>  tz       Europe/Paris                
#>  date     2021-02-17                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date       lib source             
#>  assertthat    0.2.1   2019-03-21 [1] standard (@0.2.1)  
#>  backports     1.2.0   2020-11-02 [1] standard (@1.2.0)  
#>  cli           2.2.0   2020-11-20 [1] standard (@2.2.0)  
#>  colorspace    2.0-0   2020-11-11 [1] standard (@2.0-0)  
#>  crayon        1.3.4   2017-09-16 [1] standard (@1.3.4)  
#>  digest        0.6.27  2020-10-24 [1] standard (@0.6.27) 
#>  dplyr         1.0.2   2020-08-18 [1] standard (@1.0.2)  
#>  ellipsis      0.3.1   2020-05-15 [1] standard (@0.3.1)  
#>  evaluate      0.14    2019-05-28 [1] standard (@0.14)   
#>  fansi         0.4.1   2020-01-08 [1] standard (@0.4.1)  
#>  farver        2.0.3   2020-01-16 [1] standard (@2.0.3)  
#>  fs            1.5.0   2020-07-31 [1] standard (@1.5.0)  
#>  generics      0.1.0   2020-10-31 [1] standard (@0.1.0)  
#>  ggplot2     * 3.3.3   2020-12-30 [1] standard (@3.3.3)  
#>  glue          1.4.2   2020-08-27 [1] standard (@1.4.2)  
#>  gtable        0.3.0   2019-03-25 [1] standard (@0.3.0)  
#>  highr         0.8     2019-03-20 [1] standard (@0.8)    
#>  htmltools     0.5.1.1 2021-01-22 [1] standard (@0.5.1.1)
#>  knitr         1.30    2020-09-22 [1] standard (@1.30)   
#>  labeling      0.4.2   2020-10-20 [1] standard (@0.4.2)  
#>  lifecycle     0.2.0   2020-03-06 [1] standard (@0.2.0)  
#>  magrittr      2.0.1   2020-11-17 [1] standard (@2.0.1)  
#>  munsell       0.5.0   2018-06-12 [1] standard (@0.5.0)  
#>  pillar        1.4.7   2020-11-20 [1] standard (@1.4.7)  
#>  pkgconfig     2.0.3   2019-09-22 [1] standard (@2.0.3)  
#>  purrr         0.3.4   2020-04-17 [1] standard (@0.3.4)  
#>  R6            2.5.0   2020-10-28 [1] standard (@2.5.0)  
#>  ragg        * 1.1.0   2021-02-15 [1] standard (@1.1.0)  
#>  reprex        1.0.0   2021-01-27 [1] standard (@1.0.0)  
#>  rlang         0.4.10  2020-12-30 [1] standard (@0.4.10) 
#>  rmarkdown     2.5     2020-10-21 [1] standard (@2.5)    
#>  rstudioapi    0.13    2020-11-12 [1] standard (@0.13)   
#>  scales        1.1.1   2020-05-11 [1] standard (@1.1.1)  
#>  sessioninfo   1.1.1   2018-11-05 [1] standard (@1.1.1)  
#>  stringi       1.5.3   2020-09-09 [1] standard (@1.5.3)  
#>  stringr       1.4.0   2019-02-10 [1] standard (@1.4.0)  
#>  styler        1.3.2   2020-02-23 [1] standard (@1.3.2)  
#>  systemfonts   1.0.1   2021-02-09 [1] standard (@1.0.1)  
#>  textshaping   0.3.0   2021-02-10 [1] standard (@0.3.0)  
#>  tibble        3.0.4   2020-10-12 [1] standard (@3.0.4)  
#>  tidyselect    1.1.0   2020-05-11 [1] standard (@1.1.0)  
#>  vctrs         0.3.5   2020-11-17 [1] standard (@0.3.5)  
#>  withr         2.3.0   2020-09-22 [1] standard (@2.3.0)  
#>  xfun          0.19    2020-10-30 [1] standard (@0.19)   
#>  yaml          2.2.1   2020-02-01 [1] standard (@2.2.1)  
#> 
#> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions