On Monday 26 April 2010 18:59:41 KrishnaPribadi wrote: > Peter Buschman-2 wrote: > > I ended up finding a solution to this by using a FixedLocator and > > manually setting each of the tick > > positions for both major and minor grids without overlap. > > > > I'm not sure if this is the recommended way to do this, but hey, it > > worked ;-) > > > > for tick in range(seconds+1)[1:]: > > if tick % major_multiple == 0: > > xmajorticks.append(tick) > > elif tick % minor_multiple == 0: > > xminorticks.append(tick) > > > > ax.xaxis.set_major_locator(FixedLocator(xmajorticks)) > > ax.xaxis.set_minor_locator(FixedLocator(xminorticks)) > > Hi there, > I know this is an old post, but I'm also trying to do something similar, > but using different linestyles for the major and minor grids. > > Has anyone figured out code that's more efficient than this? It seems that > this can slow down my application's data "load time". Also, since I'm using > the zoom widget, I'm not certain if this will work if the tick markers > change If I change my x limits... Any thoughts?
Hi Krishna, I'm not sure about using FixedLocator if you want to zoom ... What about the following approach: from matplotlib import pyplot as plt ax = plt.subplot(111, autoscale_on=False, xlim=(10, 1000), ylim=(10, 1000)) ax.set_xscale('log') ax.set_yscale('log') ax.grid(which='major', linestyle='-', color='blue') ax.grid(which='minor', linestyle='--', color='red') plt.show() Kind regards, Matthias ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users