Monthly Archives: July 2021

Using different fonts with ggplot2

Statistical Odds & Ends

I was recently asked to convert all the fonts in my ggplot2-generated figures for a paper to Times New Roman. It turns out that this is easy, but it brought up a whole host of questions that I don’t have the full answer to.

If you want to go all out with using custom fonts, I suggest looking into the extrafont and showtext packages. This post will focus on what you can do without importing additional packages.

Let’s make a basic plot and see its default look (I am generating this on a Mac with the Quartz device):

To change all text in the figure to Times New Roman, we just need to update the text option of the theme as follows:

ggplot allows you to change the font of each part of the figure: you just need to know the correct option to modify in the theme. (For a…

View original post 223 more words