Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add gridlines in Matplotlib

📅 2013-Oct-04 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ gridlines, matplotlib, python ⬩ 📚 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


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧