In this tutorial I will be walking you thorugh some of the basics when inserting gridline and tickets of a matplotlib graph.

Buy Me a Coffee? Your support is much appreciated!
PayPal Me:
Venmo: @Jie-Jenn

Python Code

import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator

fig = plt.figure(figsize=(8, 6))
axes = plt.subplot(1, 1, 1)
axes.axis([0, 12, 0, 10])

# major ticks

# minor ticks

# major gridlines
axes.grid(which='major', axis='x', linewidth=1, linestyle='-', color='lime', alpha=0.5)
axes.grid(which='major', axis='y', linewidth=1, linestyle='-', color='green', alpha=0.5)

# minor gridlines
axes.grid(which='minor', axis='x', linewidth=1, linestyle='-', color='firebrick', alpha=0.5)
axes.grid(which='minor', axis='y', linewidth=1, linestyle='-', color='firebrick', alpha=0.5)