I am having a hard time plotting grid lines under my graphs without messing with the main x and y axis zorder:
import matplotlib.pyplot as plt import numpy a
A easier and better solution is to copy the lines from the grid command and disable the grid and again add the lines again but with correct zorder:
ax.grid(True) lines = ax.xaxis.get_gridlines().copy() + ax.yaxis.get_gridlines().copy() ax.grid(False) for l in lines: ax.add_line(l) l.set_zorder(0)