Skip to main content
Albero Academy

Labels, Titles & Legends

The text that makes a chart self-explanatory.

Customizing Plots8 min

A chart without labels is a puzzle. Titles, axis labels and legends turn a picture into a message someone can read without you standing next to them explaining it.

The essential text

label everything
ax.set_title("Revenue by quarter", fontsize=14, fontweight="bold")
ax.set_xlabel("Quarter")
ax.set_ylabel("Revenue (₹ lakh)") # always include units!
ax.legend(loc="upper left") # uses each series' label=

Legends

The legend maps colours/styles to meaning. It's built from the label= you passed to each plot call:

legend control
ax.plot(x, y1, label="2025")
ax.plot(x, y2, label="2026")
ax.legend(loc="best", frameon=False, ncol=2) # position, no box, 2 columns

Key takeaways

  1. 01set_title, set_xlabel, set_ylabel make a chart self-explanatory.
  2. 02Always include units in axis labels.
  3. 03ax.legend() builds a legend from each series' label=.
  4. 04A good title states the insight, not just the variables.

Finished this chapter?

Mark it complete to track your progress through Matplotlib.