Skip to content

Instantly share code, notes, and snippets.

@tanerumit
Forked from dsparks/Custom font in ggplot2.R
Last active January 16, 2021 13:45
Show Gist options
  • Save tanerumit/3a5a4a39ba44b2f7cd9193af40676b64 to your computer and use it in GitHub Desktop.
Save tanerumit/3a5a4a39ba44b2f7cd9193af40676b64 to your computer and use it in GitHub Desktop.
#R #ggplot2 use any font on the system
require(extrafont)
require(ggplot2)
font_import(pattern = "GIL", prompt = FALSE) # Import Gill family
loadfonts(device="win") # Load them all
fonts() # See what fonts are available
zp1 <- ggplot(data = iris,
aes(x = Sepal.Length, y = Sepal.Width, label = Species))
zp1 <- zp1 + geom_text(family = "Gill Sans MT")
zp1 <- zp1 + theme(text=element_text(family="Gill Sans Ultra Bold"))
print(zp1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment