Python Matplotlib

Matplotlib Grid

Adding grid to plots

Matplotlib Grid

You can use the grid() function to add grid lines to the plot.

Adding Grid

import matplotlib.pyplot as plt

x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]

plt.plot(x, y)
plt.grid()
plt.show()