You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get warning when I use a non-default font. (It can be silenced when setting "ggpubr.null_device", but it sometimes doesn't work)
Steps to reproduce the problem
withr::local_language("en")
library(ggplot2)
grDevices::dev.cur()
#> png #> 2
library(ggpubr)
# tidyverse/ggplot2#5350p1<-mtcars|> ggplot(aes(disp, mpg)) +
geom_point() +
theme(
text= element_text(family="Gotham")
)
p1#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :#> font family not found in Windows font database
ggarrange(p1)
#> Warning in grid.Call(C_stringMetric, as.graphicsAnnot(x$label)): font family#> 'Gotham' not found in PostScript font database
options(
"ggpubr.null_device"=ragg::agg_png
)
ggarrange(p1)
#> Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :#> font family not found in Windows font database
Expected behavior
I would expect ggpubr to respect the graphic device set in RStudio like ggplot2 does, specifically the AGG device.
Special Handling in the case of RStudio. RSTUDIO_GD
https://github.com/tidyverse/ggplot2/blob/main/R/utilities-checks.R
Actual behavior
I get warning when I use a non-default font. (It can be silenced when setting "ggpubr.null_device", but it sometimes doesn't work)
Steps to reproduce the problem
Created on 2023-10-05 with reprex v2.0.2
Session info
Note that warnings in the first and third plots only show up in non-interactive sessions, but I left them in case they are helpful.
Setting the option is great, but ggpubr could detect the device better like what was done in tidyverse/ggplot2#5350
The text was updated successfully, but these errors were encountered: