Skip to main content
Albero Academy

Spines & Grids

Remove chart junk — clean up borders and add helpful gridlines.

Figures & Layout7 min

The spines are the four border lines of an Axes. Removing the top and right ones — a "chart junk" cleanup — instantly makes a plot look more modern and professional. Gridlines, used lightly, aid reading values.

Cleaning up spines

remove chart junk
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
# now only the left and bottom borders remain — cleaner

Gridlines

subtle grids
ax.grid(True, axis="y", alpha=0.3) # faint horizontal gridlines only
ax.set_axisbelow(True) # draw grid behind the data

Key takeaways

  1. 01Spines are the Axes border lines; hiding top/right cleans up the look.
  2. 02ax.grid(axis="y", alpha=0.3) adds faint gridlines to aid reading.
  3. 03set_axisbelow(True) puts the grid behind the data.
  4. 04Reducing non-data ink (chart junk) makes the data stand out.

Finished this chapter?

Mark it complete to track your progress through Matplotlib.