gg_font_change: Change the font in all text layers of a ggplot

View source: R/gg_font_change.R

gg_font_changeR Documentation

Change the font in all text layers of a ggplot

Description

Change the font in all text layers of a ggplot

Usage

gg_font_change(p, font = "Arial")

Arguments

p

A ggplot2 object

font

Name of a font, such as "Arial", "sans", or "Roboto"

Value

A ggplot object with the family parameter of text layers set to the provided font

Examples


library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point() +
  geom_text(aes(label = mpg))

gg_font_change(p, "serif")

djpr-data/djprtheme documentation built on April 15, 2023, 2:47 a.m.