I want to get both horizontal and vertical grid lines on my plot but only the horizontal grid lines are appearing by default. I am using a
ax = plt.axes()
ax.yaxis.grid() # horizontal lines
ax.xaxis.grid() # vertical lines
You may need to give boolean arg in your calls, e.g. use
ax.yaxis.grid(True) instead of
ax.yaxis.grid(). Additionally, since you are using both of them you can combine into
ax.grid, which works on both, rather than doing it once for each dimension.
ax = plt.gca() ax.grid(True)
That should sort you out.