Skip to content

Conversation

@jklymak
Copy link
Member

@jklymak jklymak commented Dec 8, 2017

PR Summary

Fixes #9863

The GUI home state was being set on the first draw() due to PRs #6598 #9359. However, draw is called by some tools to get fontsizes etc, and some users were changing plot parameters after that draw().

This reverts to the home state being set in Pan and Zoom if the Home state is empty. Other tools should include the same logic if they want to register the Home state when they are called:

if self._nav_stack() is None:
            # set the home button to this view
            self.push_current()

Happy if someone has a better solution. Perhaps instead of at draw time, the appropriate time is when the toolbar is created (NavigationToolbar2.__init__?).

The test is the same as in #9863:

import numpy as np
import matplotlib.pyplot as plt

x = np.random.rand(10, 10)

f, ax = plt.subplots()
ax.pcolormesh(x)
ax.figure.draw(ax.figure.canvas.get_renderer())
ax.invert_yaxis()

plt.show()

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v2.2 milestone Dec 8, 2017
@jklymak jklymak requested a review from anntzer December 8, 2017 22:45
@anntzer
Copy link
Contributor

anntzer commented Dec 9, 2017

I think that's fine for now, we may want to revisit later whether to push the original position when creating the toolbar.

@anntzer anntzer merged commit 00c4b80 into matplotlib:master Dec 9, 2017
@jklymak
Copy link
Member Author

jklymak commented Dec 9, 2017

Seems like toolbar is created before any axes are put in place so that doesn’t work. I thought about doing at show somehow but wasn’t clever enough to get it to call with all the different backend show commands.

@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
@jklymak jklymak deleted the fix-toolbarstack branch March 5, 2019 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Y-axis value of a seaborn heatmap is reversed when home icon or H button is pushed

4 participants