Introduction
Know your problem
Know your data
Visualise your data
Work with your chart
18. Tip: add a chart title
Check yourself

Instruction

Everyone who sees your chart should understand what it is about right away – no matter whether they know the data or not. Therefore, we'll give our bar chart a title.

Titles should be located in the left top corner and should describe the topic of the chart. Don't make your title overly long, but do feel free to mention the variables and units used.

The labs command assigns a title to a plot. It looks like this:

labs(title = "some title")

Simply add this to your plot using the + sign. Put your title in double quotes, like "some title" is in the example.

We might call our chart: "Number of countries by pattern of alcohol consumption". This explains these mysterious variables from the chart, pattern: it means the overall pattern of alcohol consumption, and 'n' - the number of countries where this pattern is reported.

Come up with your own title for this plot. Remember to describe what the chart is about so anyone can understand it.

Exercise

Add a title to the barplot using the labs command. Press the Run and Check Code button when you're done.

Stuck? Here's a hint!

You should write:

labs(title = "Number of countries by pattern of alcohol consumption")