r-lib/ragg

ggplot2 font changes when deployed and rendered with ragg

Closed this issue · 1 comments

When ragg is specified as the graphics device in my app via options(shiny.useragg = TRUE) the font changes when deployed (via shinyapps.io) versus when seen locally. Disabling ragg returns the font to the same that is used when rendering locally.
Rendered with ragg on shinyapps.io:
with_ragg
Rendered without ragg or local:
without_ragg

Here is the code for the plot:

ggplot(data = df_Zins, aes(x = Jahre, y = Aktueller_Kredit, color = Szenario)) + 
        geom_path() +
        geom_vline(xintercept = Zinsbindung, linetype = 2, color = "darkred", size = 2) +
        theme_minimal() +
        scale_y_continuous(labels = Kommaformatieren, limits = c(0, Anfangs_Kredit + 100000)) +
        labs(
          x = "Jahre nach Kreditabschluss",
          y = "Restschuld"
        ) +
        theme(text = element_text(size = 20),
              legend.position = "bottom",
              plot.title = element_text(hjust = 0.5))

Ragg uses the default font defined by the OS if none is specified. On windows and Mac this is fairly well established, but on linux systems it depend on the content of the systems font-config file... In general you shouldn't rely on non-specified fonts when rendering between systems