I have a seemingly simple problem which I cannot figure out the cause of. I cannot get Greek characters into the Y/X-axis labels in a ggplot, if I save using the ragg device.
Reprex:
library(ggplot2)
library(ragg)
data("mtcars")
beta_plot <- ggplot(mtcars) +
geom_point(aes(x = mpg, y = disp)) +
ylab(bquote(beta))
tf <- tempfile(fileext = ".png")
ggsave(
filename = tf,
plot = beta_plot,
device = ragg::agg_png,
width = 800,
height = 800,
units = "px",
res = 300
)
Created on 2021-07-19 by the reprex package (v2.0.0)
This is the output:
In contrast, this is the output on the RStudio viewer:
I believe that if I change the device to Cairo, the beta term appears, but I would rather use ragg for version control purposes etc.
sessionInfo()
#> R version 3.6.3 (2020-02-29)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Arch Linux
#>
#> Matrix products: default
#> BLAS: /usr/lib/libopenblasp-r0.3.15.so
#> LAPACK: /usr/lib/liblapack.so.3.10.0
#>
#> locale:
#> [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
#> [4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
#> [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] knitr_1.33 magrittr_2.0.1 rlang_0.4.11 fansi_0.5.0
#> [5] stringr_1.4.0 styler_1.4.1 highr_0.9 tools_3.6.3
#> [9] xfun_0.24 utf8_1.2.1 withr_2.4.2 htmltools_0.5.1.1
#> [13] ellipsis_0.3.2 yaml_2.2.1 digest_0.6.27 tibble_3.1.2
#> [17] lifecycle_1.0.0 crayon_1.4.1 purrr_0.3.4 vctrs_0.3.8
#> [21] fs_1.5.0 glue_1.4.2 evaluate_0.14 rmarkdown_2.9
#> [25] reprex_2.0.0 stringi_1.6.2 compiler_3.6.3 pillar_1.6.1
#> [29] backports_1.2.1 pkgconfig_2.0.3
Created on 2021-07-19 by the reprex package (v2.0.0)
Is this a setting issue somewhere, a bug, or a misconfiguration?