Introduction
Line plots
Multiple histograms
12. Suptitles and titles
Other plot types
Summary

Instruction

Great! Finally, we want to add a title to the whole figure, as well as a title to each subplot:

figure.suptitle('Height Distribution')
subplot1.set_title('Women')
subplot2.set_title('Men')

Here, figure.suptitle adds a "global" title to the whole figure, whereas subplot.set_title adds a title to a specific subplot.

Finally, our figure looks lie this:

Sample hist

Exercise

Add the following elements:

  • Figure title: Salary Distribution by Department,
  • Left subplot title: Accounting,
  • Middle subplot title: IT, and
  • Right subplot title: Consulting.

Stuck? Here's a hint!

Use figure.suptitle for the whole figure, and subplot.set_title for individual subplots.