[Matplotlib-users] MaxNLocator and steps [2.0.0rc0]

Eric Firing efiring at hawaii.edu
Sun Jan 8 20:09:23 EST 2017


On 2017/01/08 2:44 PM, Brian McFee wrote:
> Hi everyone [long-time user, first-time poster],
>
> I recently ran aground of a change in MaxNLocator introduced in 2.0.0rc0
> by this PR: https://github.com/matplotlib/matplotlib/pull/7586.  This
> change warns if the steps parameter has values outside the range [1,
> 10], and is justified in the
> issue https://github.com/matplotlib/matplotlib/issues/7578 by compliance
> with the docstring.
>
> I have been using MaxNLocator with steps=[1, 5, 10, 15, 60] (or
> thereabouts) to label time-axis plots with units in seconds, and
> position ticks at "nice" fractions of minutes.  Apparently, I've been
> doing it wrong!  Does anyone have advice about how to recover the
> previous behavior without doing-it-wrong?

Try [1, 1.5, 5, 6, 10].  There might be cases where this will not do 
what you want; if so, give me some examples to work with.  I have a 
suspicion that what is really needed here is a different algorithm--to 
cover cases that perhaps the old algorithm handled by accident.

Is it the case that you want a locator that would use *only* your 
specified set of steps as the intervals between ticks?  I think what is 
needed for that is an extension of MultipleLocator that works with a 
list of bases rather than with a single base.

There might be a simple modification of the MaxNLocator with 
integer=True, that would suffice in practice, though.

Eric

>
>
> Thanks!
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>



More information about the Matplotlib-users mailing list