View source: R/gg_font_change.R
gg_font_change | R Documentation |
Change the font in all text layers of a ggplot
gg_font_change(p, font = "Arial")
p |
A ggplot2 object |
font |
Name of a font, such as "Arial", "sans", or "Roboto" |
A ggplot object with the family
parameter of text layers
set to the provided font
library(ggplot2)
p <- ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
geom_text(aes(label = mpg))
gg_font_change(p, "serif")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.