On 3/26/12 12:49 PM, Christopher Graves wrote:
> On Sun, Mar 11, 2012 at 2:32 PM, Christopher Graves
> <christoph.gra...@gmail.com <mailto:christoph.gra...@gmail.com>> wrote:

>         Try this:
>
>         from pylab import *
>         from matplotlib.ticker import AutoMinorLocator
>
>         clf()
>         ax=subplot(111)
>         ax.autoscale(tight=True)
>         plot([1,2,4],[1,2,3])
>         ax.xaxis.set_minor_locator(__AutoMinorLocator(2))
>         ax.yaxis.set_minor_locator(__AutoMinorLocator(2))
>         draw()
>
>         M
>
>         PS: I believe this is a fairly new feature...
>
>
>     Thanks! Great news that AutoMinorLocator has been added and
>     accomplishes this. Regarding the P.S. I can confirm that the feature
>     was not in matplotlib 1.0.1 - I had to update to 1.1.0 to use it.
>
>     Best /Chris
>
>
>
> Hi Mike,
>
> A follow-up question... When using that, if one then tries to manually
> use the zoom-box tool available with a matplotlib plot, if one draws too
> small of a box (less than 2 major ticks in x or y dimension, based on
> the following error message), it gives the following error and further
> operations on the plot do not work.
>
> ValueError: Need at least two major ticks to find minor tick locations
> ( File "/usr/lib/pymodules/python2.7/matplotlib/ticker.py", line 1528,
> in __call__ )
>
> Any way to avoid this for now? (And ultimately, should this be made into
> a bug fix request?)

Ok, I seem to remember seeing this error before, but I can't trip it now 
(with either 1.1.1rc or today's git checkout of 1.2.x). Do you have
a short script that can reproduce this? For me, the zoom-box tool seems 
to be [correctly] setting the majortick locations as I zoom in, thus 
preventing this exception. I should note that I'm using the GTKAgg 
frontend. This may be the issue. A long time ago I was using the MacOSX 
frontend, and maybe this was when I was seeing it...

Aside from that, this would be a bug.

M

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to