Legends and annotations

Legends and annotations are effective tools to display information required to comprehend a plot in a glance. A typical plot will have the following additional information elements:

  • A legend describing the various data series in the plot. This is provided by invoking the matplotlib legend() function and supplying the labels for each data series.
  • Annotations for important points in the plot. The matplotlib annotate() function can be used for this purpose. A matplotlib annotation consists of a label and an arrow. This function has many parameters describing the label and arrow style and position, so you may need to call help(annotate) for a detailed description.
  • Labels on the horizontal and vertical axes. These labels can be ...

Get Python Data Analysis now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.