This is a brief tutorial on how to add labels to plots outside the plotting area in both basic plots and for ggplot2. I use this to label panels “A”, “B”, “C”, etc. but figuring out how to do this was surprisingly difficult. Here is my solution:
Here are the plots generated using the basic plot function:
…and the second example with basic plot. In this plot the top margin is smaller:
basic plot with panels labeled “A” and “B” in R
Here are the plots using ggplot2:
…and the vertical version:
If you want to tweak the exact location of the plot labels, this is easily done in ggplot2. You simply adjust the x and y values by very small increments, making sure to stay between 0 and 1.