Skip to content

Instantly share code, notes, and snippets.

@dsparks
Last active June 27, 2017 13:20
Show Gist options
  • Save dsparks/10408082 to your computer and use it in GitHub Desktop.
Save dsparks/10408082 to your computer and use it in GitHub Desktop.
Load, then 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)
@jrvianna
Copy link

The ggplots with Gill Sans MT look ok on the screen, but when saving to pdf (on Mac) get "font width unknown for character ..." errors and some symbols such as minus or µ don't appear on the saved pdf. Any way to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment