Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Visualize your data
Work with your chart 2
14. Add axis titles to your chart
Check yourself

Instruction

Create meaningful axis titles.

We already know that every chart should be described. We know that we can change the title of the whole chart to do that, but we can also elaborate our axis titles.

Axis titles should precisely describe what is presented and the units used. You shouldn't use playful or catchy text here – just focus on an accurate description of the data. If you put info about the units used in the main title, you can omit it here.

To change axis titles in ggplot, we add a labs command with these two arguments:

labs(x="horizontal_axis_title", y="vertical_axis_title")

Argument x specifies the title of the horizontal axis, and argument y defines the vertical axis title.

Exercise

Add meaningful titles for both axes. Use the labs() command. Set the x argument to "alcohol consumption per capita, in liters". Set the y argument to "number of countries".

When you're done, press Run and Check Code.

Stuck? Here's a hint!

You should add a second labs command:

labs(x = "alcohol consumption per capita, in liters", y = "number of countries")