python - Getting vertical gridlines to appear in line plot in matplotlib -


i want both horizontal , vertical grid lines on plot horizontal grid lines appearing default. using pandas.dataframe sql query in python generate line plot dates on x-axis. i'm not sure why not appear on dates , have tried search answer couldn't find one.

all have used plot graph simple code below.

data.plot() grid('on') 

data dataframe contains dates , data sql query.

i have tried adding code below still same output no vertical grid lines.

ax = plt.axes()         ax.yaxis.grid() # horizontal lines ax.xaxis.grid() # vertical lines 

any suggestions?

enter image description here

you may need give boolean arg in calls, e.g. use ax.yaxis.grid(true) instead of ax.yaxis.grid(). additionally, since using both of them can combine ax.grid, works on both, rather doing once each dimension.

ax = plt.gca() ax.grid(true) 

that should sort out.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -