-1

I know how I can change fonts using THIS POST

Here is my problem. I have a "super function" that accesses many others functions that use ggplot and ggsave for pdf.

How can I set the font style globally (in my case: "Times new roman") so I only have to set the font family at one position?

Andre Elrico
  • 10,956
  • 6
  • 50
  • 69

1 Answers1

1

Something like this:

update_geom_font_defaults <- function(family="Times new roman", face="plain", size=3.5,
                                      color = "#2b2b2b") {
  update_geom_defaults("text", list(family=family, face=face, size=size, color=color))
  update_geom_defaults("label", list(family=family, face=face, size=size, color=color))
}

But you may need to account for more text geoms.

This is a function from https://github.com/hrbrmstr/hrbrthemes/blob/master/R/theme-ipsum.r#L171-L181

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205