MaxNLocator and steps [2.0.0rc0]

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?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170109/c487ff1c/attachment.html>

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

···

On 2017/01/08 2:44 PM, Brian McFee wrote:

Thanks!

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

Brian,

See https://github.com/matplotlib/matplotlib/pull/7770. This is what I
had in mind to get MaxNLocator behavior closer to what you want. I
think the problem that would remain is that sometimes you would get
6-second intervals, which you probably don't want.

I'm not sure whether the way to get exactly what you want (assuming I
understand it correctly) is via an additional kwarg to MaxNLocator, or
whether it would be better to make a different locator for this purpose.

Eric

···

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?

Thanks!

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