The plot title and axis labels
As you saw when creating a plot with ggplot2
, the default result will be a plot without any title and with axis labels corresponding to the names of the variables represented in the plot. In many cases, you will want to personalize things such as labels, particularly if you are interested in including not only the name of the variable, but also its units. Alternatively, you might also be interested in providing more descriptive labels than simply the title of the variable. In this section, we will see examples of how to change three different types of details: how to change the title and labels of the axis, how to change the scale represented in the x and y axes, and how to remove them if you don't want to have them in the plot.
In order to change the plot title, there are two main options that you can choose from:
- There is the possibility of changing the title and axis label using specific functions:
ggtitle()
for the title andxlab()
andylab()
for the...