From: Neal B. <ndb...@gm...> - 2011-01-06 12:48:07
|
Paul Ivanov wrote: > Neal Becker, on 2011-01-05 08:19, wrote: >> I want to plot semilogy with major and minor grid. I tried: >> >> plt.grid(which='both') >> >> But 2 problems: >> >> 1) For semilogy, most of my viewers will expect to see 10 minor >> ticks/major tick. I got 5. How do I change it? > > Hi Neal, > > odd, it works here. (See attached image) > > In [1]: plt.semilogy(((np.random.rand(50)*9+1))) > > If your problem persists, can you provide a small example where > this does not work? You might check the minor locator - make > sure that it is base 10 Perhaps because my data covered a large range 10**-7 ... 10**0? I'll try some experiments. I had to force it with: fig.get_axes()[0].set_yticks ([a*(10**b) for b in xrange (-7,0) for a in xrange (1,10) ], minor=True) > In [2]: plt.gca().yaxis.minor.locator._base > Out[2]: 10.0 > >> 2) I'd like the major ticks to be solid lines, and minor ticks >> to be dashed. I got all dashed. > > In [3]: plt.grid(which='major', linestyle='solid') > In [4]: plt.grid(which='minor', linestyle='dashed') > |