Know your data
Visualize your data – categorical variables
Work with your chart 2
18. Add a chart title and source info
Check yourself 2

Instruction

Always add a title and source info to your chart.

Always add a title to your chart. This ensures that everyone, no matter if they know the data or not, understands what is presented on your chart. We've already discussed what makes a good title when we looked at the scatter plot; the same applies here.

And once again, adding the source of your data to your chart makes it more credible.

To add this information to the chart, use the following command:

+labs(title="your_title", subtitle="your-subtitle", caption="your source")

Obviously, you'll add your own title, subtitle, and source info where the placeholder texts are. Don't forget the double quotes!

Exercise

Add a title, a subtitle, and data source information to your chart. Follow the syntax used above.

A sample title might be "Wealthy means drunk?". A sample subtitle might be: "Relationship between the wealth of country and its alcohol consumption". The source information is: "Source: WHO and World Bank, 2010"

Stuck? Here's a hint!

You should write:

labs(
  title = "Does Wealthy Equal Drunk?", 
  subtitle = "The relationship between a country's wealth and its alcohol consumption", 
  caption = "Source: WHO and World Bank, 2010")