Enrich Matplotlib Plots with Annotations

Guide the viewer’s attention.

DataMantra
2 min readApr 14, 2024

While creating data visualizations, there are often certain parts that are particularly important, and they may require some additional context.

Yet, this additional information may not be immediately obvious to the viewer.

A good data storyteller always ensures that:

  • The plot guides the viewer’s attention to these key areas.
  • The plot concisely provides any information needed for better interpretation.

One great (yet underrated) to provide extra info is by adding text annotations to a plot, as depicted below:

Source: Daily Dose of Data Science

Such efforts always ensure that the plot indeed communicates what we intend it to depict — even if the plot’s creator is not present at that time.

In matplotlib, you can use 𝐚𝐧𝐧𝐨𝐭𝐚𝐭𝐞(), as depicted below:

Source: Daily Dose of Data Science

It adds explanatory texts to your plot, which lets you guide a viewer’s attention to specific areas and aid their understanding.

👉 If you liked this post, please leave a like ❤️ and Subscribe to DataMantra.

Explore DataMantra’s comprehensive courses and start your journey to mastering data analytics today at Datamantra.com

Reach out to us effortlessly at:

https://www.linkedin.com/in/tarunsachdeva7997/
Hello@thedatamantra.com

--

--

DataMantra
DataMantra

Written by DataMantra

DataMantra is an Edtech platform and founded by Tarun Sachdeva who is based out of Belgium and specialised in Tableau, SQL, ML, Python, Deep Learning & Gen AI.

No responses yet