FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

FIX: update spine positions before get extents by jklymak · Pull Request #11754 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 0 additions & 8 deletions lib/matplotlib/_constrained_layout.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ def do_constrained_layout(fig, renderer, h_pad, w_pad,

'''

try:
if fig.canvas.toolbar._active in ('PAN', 'ZOOM'):
# don't do constrained layout during zoom and pan.
return
except AttributeError:
# not toolbar, or no _active attribute..
pass

invTransFig = fig.transFigure.inverted().transform_bbox

# list of unique gridspecs that contain child axes:
Expand Down
6 changes: 6 additions & 0 deletions lib/matplotlib/spines.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ def get_patch_transform(self):
else:
return super().get_patch_transform()

def get_window_extent(self, renderer=None):
# make sure the location is updated so that transforms etc are
# correct:
self._adjust_location()
return super().get_window_extent(renderer=renderer)

def get_path(self):
return self._path

Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_axes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5782,3 +5782,13 @@ def test_zoom_inset():
[0.8425, 0.907692]])
np.testing.assert_allclose(axin1.get_position().get_points(),
xx, rtol=1e-4)


def test_spines_properbbox_after_zoom():
fig, ax = plt.subplots()
bb = ax.spines['bottom'].get_window_extent(fig.canvas.get_renderer())
# this is what zoom calls:
ax._set_view_from_bbox((320, 320, 500, 500), 'in',
None, False, False)
bb2 = ax.spines['bottom'].get_window_extent(fig.canvas.get_renderer())
np.testing.assert_allclose(bb.get_points(), bb2.get_points(), rtol=1e-6)

Back | FazBrowse Home | New Git URL