python - Major and minor grid lines and ticks using matplotlib -


i have 2 big intergers

min=round(raw_min,-5) # negative number max=round(raw_max,-5) 

from range of interesting ticks:

xticks=np.arange(min,max,500000) 

on x-axis, want have minor ticks (including labels) xticks range. furthermore, want have major tick , grid line @ value 0. tried add:

minorlocator = fixedlocator(xticks) majorlocator = fixedlocator([0])  ax.xaxis.set_major_locator(majorlocator) ax.xaxis.set_major_formatter(formatstrformatter('%d')) ax.xaxis.set_minor_locator(minorlocator) plt.tick_params(which='both', width=1) plt.tick_params(which='major', length=7, color='b') plt.tick_params(which='minor', length=4, color='r') ax.yaxis.grid(true) ax.xaxis.grid(b=true,which='major', color='b', linestyle='-') 

but doesn't work...

enter image description here

no ticks minors , no grid line major.

any ideas?

seems missing following line:

plt.grid(b=true,which='both') 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -