

Without any context, it is difficult to immediately understand what is interesting about the graph. What is interesting about the chart? What is the take-home message? Standard matplotlib chart with a 'functional' title. title ( "Spotify and Netflix's share price rebased to January 2020", fontsize = 14, pad = 10, loc = "left", ) plt. plot ( figsize = ( 12, 8 ), color = ) plt.

Library to collect data and matplotlib to create the visualisation Let’s visualise how this has impacted their share price performance. There has been a lot of negative news about streaming services such Netflix and Spotify. However, I like to use plt.suptitle to create a headline with my key message and then use plt.title for the more conventional title that describes what is being plotted.Ĭode and further examples are provided in this notebook

In theory you could use plt.title as your headline. Which allows you to add a second title (subtitle) to your charts. However, there is a handy, but less well known function called plt.suptitle Matplotlib is the defacto method for visualising data in Python.Īdding titles in Matplotlib is very easy – just use plt.title How can you add subtitles to Matplotlib charts? # Leave your audience in no doubt about what the visualisation is showing them and why it is important to them. These act as ‘headlines’ containing the key take-home message which aids your audience to interpret the graph for themselves. One of the best ways to improve the accessibility and persuasiveness of visualisations is to add descriptive subtitles to your charts. You need to cater for this fact in order to generate the most impact from your visualisation. The outputs of your analysis will likely be viewed by many different business stakeholders with varying familiarity with your dataset.

In the business domain, this academic approach often falls short and misses a great opportunity to drive home your message. In these academic environments, we are told the purpose of the chart title is purely functional and should only describe the quantities being plotted on the x and y axes.įunctional titles tell the reader what the graph is plotting, but nothing about what the graph is showing or why this is interesting. However, in general, visualisation for business communication is not something that is taught well in school or university courses. Why should you add headlines or subtitles to your charts? #Įffective data visualisation is a vital skill for communicating outputs to stakeholders.
#MATPLOT LIB SUBPLOT TITLES HOW TO#
How to add titles and subtitles to your Matplotlib charts using plt.suptitle.Gs = gridspec.GridSpecFromSubplotSpec(1, 3, subplot_spec=grid)įig. # create subgrid for two subplots without space between them Subfig.suptitle(f'Subfigure title \n', fontweight='semibold', size=14) Subfigs = fig.subfigures(nrows=3, ncols=1) Either Figure.subfigures (most straightforward)Ĭreate 3x1 fig.subfigures where each subfig gets its own 1x3 subfig.subplots and subfig.suptitle: fig = plt.figure(constrained_layout=True).See how to plot subfigures for further details. The new subfigure feature allows creating virtual figures within figures with localized artists (e.g., colorbars and suptitles) that only pertain to each subfigure. Row titles can now be implemented as subfigure suptitles:
