Skip to content

FIX: update spine positions before get extents #11754

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

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Jul 23, 2018

PR Summary

Closes #11737 (supercedes #11739, #11742)

If you zoomed on an axes, get_tightbbox would return a huge bounding box because spine objects didn't have their x/ylims properly set from the axis info yet. This PR sets those limits when get_window_extent is called making the bounding box accurate..

This also rolls back a change in #11627 where constrained_layout was turned off under ZOOM and PAN...

PR Checklist

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

@jklymak jklymak mentioned this pull request Jul 23, 2018
6 tasks
@jklymak jklymak added status: work in progress Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labels Jul 23, 2018
@jklymak jklymak added this to the v3.0 milestone Jul 23, 2018
@jklymak jklymak changed the title FIX: update spine positions before gett extents FIX: update spine positions before get extents Jul 23, 2018
@fredrik-1
Copy link
Contributor

Seems to work, thanks!

@jklymak
Copy link
Member Author

jklymak commented Jul 23, 2018

@fredrik-1 Great! And thanks for catching this before 3.0 went out. Now to devise a test that fails if this doesn't work...

# make sure the location is updated so that transforms etc are
# correct:
self._adjust_location()
return self.get_path().get_extents(self.get_transform())
Copy link
Member

Choose a reason for hiding this comment

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

super().get_window_extent(renderer=renderer) instead?

@jklymak
Copy link
Member Author

jklymak commented Jul 23, 2018

...test done. The test fails on master..

@@ -4031,7 +4031,7 @@ def test_psd_noise():


@image_comparison(baseline_images=['csd_freqs'], remove_text=True,
extensions=['png'])
extensions=['png'], tol=0.002)
Copy link
Member Author

Choose a reason for hiding this comment

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

This fix is for the macOS test and doesn't affect this PR. Happy to remove it if the commits will be cleaner.

Copy link
Member

Choose a reason for hiding this comment

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

Can you throw this in another PR? It would be good to get to the bottom of the cause (I'll investigate later today) before just adding a tolerance.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed from this PR. I'll not open a new PR in lieu of you tracking down the problem (I assume you have a Mac?) If you want me to play around w/ np1.15 I can also give that a shot. Note that I don't get the test failure on my mac w/ np1.14.

@jklymak jklymak force-pushed the fix-update-spine-positions-before-getting-extents branch from 0ab9951 to 5545050 Compare July 24, 2018 17:23
@jklymak
Copy link
Member Author

jklymak commented Jul 24, 2018

The only failure is the Mac CI small 0.001 tolerance issue w/ csd caused by numpy1.15

@dstansby dstansby merged commit cb47f2d into matplotlib:master Jul 26, 2018
@jklymak jklymak deleted the fix-update-spine-positions-before-getting-extents branch July 26, 2018 16:34
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.

Bug in tight_layout
4 participants