Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add gridlines in Matplotlib

📅 2013-Oct-04 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Gridlines are the horizontal and vertical dotted lines that run across a plot. These aid in visual understanding of a plot. Adding gridlines is really easy in Matplotlib:

import matplotlib.pyplot as pyplot

# Your other plotting calls go here
pyplot.grid(True)

Tried with: Python 2.7.3 and Ubuntu 12.04 LTS