在全球位置上更改字体系列

时间:2017-07-31 11:00:41

标签: r ggplot2 fonts

我知道如何使用THIS POST

更改字体

这是我的问题。我有一个超级功能"访问许多其他使用ggplotggsave作为pdf的函数。

如何全局设置字体样式(在我的情况下:" Times new roman")所以我只需要在一个位置设置字体系列?

1 个答案:

答案 0 :(得分:1)

这样的事情:

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))
}

但您可能需要考虑更多文字geoms。

这是https://github.com/hrbrmstr/hrbrthemes/blob/master/R/theme-ipsum.r#L171-L181

的功能