8000 BUG: Fix typo in view_limits() for MultipleLocator by dopplershift · Pull Request #12313 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix typo in view_limits() for MultipleLocator #12313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2018

Conversation

dopplershift
Copy link
Contributor
@dopplershift dopplershift commented Sep 27, 2018

PR Summary

Fixes (what looks to be) a copy/paste error in MultipleLocator. Apparently, we had no tests for this code path. Before this fix, calling view_limits() on an instance of MultipleLocator (when using 'round_numbers' for axes.autolimit_mode) would give:

../../../virtualenv/python3.6.3/lib/python3.6/site-packages/matplotlib/__init__.py:1785: in inner
    return func(ax, *args, **kwargs)
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/matplotlib/axes/_axes.py:4876: in barbs
    self.autoscale_view()
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/matplotlib/axes/_base.py:2478: in autoscale_view
    'minposx', self.xaxis, self._xmargin, x_stickies, self.set_xbound)
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/matplotlib/axes/_base.py:2472: in handle_single_axis
    x0, x1 = locator.view_limits(x0, x1)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <matplotlib.ticker.MultipleLocator object at 0x7f98ab3c47f0>
dmin = -20.0, dmax = 21.89385499011344
    def view_limits(self, dmin, dmax):
        """
            Set the view limits to the nearest multiples of base that
            contain the data.
            """
        if rcParams['axes.autolimit_mode'] == 'round_numbers':
            vmin = self._edge.le(dmin) * self._edge.step
>           vmax = self._base.ge(dmax) * self._edge.step
E           AttributeError: 'MultipleLocator' object has no attribute '_base'
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/matplotlib/ticker.py:1745: AttributeError

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant

@dopplershift dopplershift added this to the v3.0.x milestone Sep 27, 2018
Copy link
Member
@jklymak jklymak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, subject to CI

@dopplershift
Copy link
Contributor Author

Circle failures are unrelated.

@tacaswell tacaswell added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Sep 27, 2018
@dopplershift
Copy link
Contributor Author

Travis error is persistent, but seems to be unrelated to this as well.

@jklymak jklymak merged commit 7afef94 into matplotlib:master Sep 27, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 27, 2018
@dopplershift dopplershift deleted the fix-limits branch September 27, 2018 22:56
jklymak added a commit that referenced this pull request Sep 28, 2018
…313-on-v3.0.x

Backport PR #12313 on branch v3.0.x (BUG: Fix typo in view_limits() for MultipleLocator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0