trevorld / gridpattern

'grid' Pattern Grobs
https://trevorldavis.com/R/gridpattern/dev
Other
30 stars 1 forks source link

RStudio Rmarkdown gradient bug #51

Closed trevorld closed 2 years ago

trevorld commented 2 years ago

Haven't tried to reproduce this myself yet but other users have reported that gradient patterns don't render in Rmarkdown documents created within RStudio:

It seems this can be resolved by setting options(ggpattern_use_R4.1_gradients = FALSE) but I'm not entirely sure why this happens in the first place:

1) Does guess_has_R4.1_features() make an incorrect inference? Is some graphics device using a name it shouldn't? 2) Does Rstudio/Rmarkdown do something overly clever like using dev.copy() to copy from a graphics device that does support R 4.1 gradients to one that does not support R 4.1 gradients? Perhaps copying from grDevices::pdf() to ragg::agg_png() (before it added support)?

This bug could theoretically apply to other patterns that use R 4.1 clipping features such as "text" and "rose" patterns and custom patterns.