Cannot get minor grid lines to appear in matplotlib figure

Unfortunately, ax.grid is a bit confusing in this regard. (This is a design bug / common gotcha.) It turns the minor grid on, but the minor ticks are still turned off.

What you need to do is call plt.minorticks_on or ax.minorticks_on in addition to calling ax.grid(True, which="both").

Leave a Comment