8000 FIX: errors in get_position changes · matplotlib/matplotlib@922cd71 · GitHub
[go: up one dir, main page]

Skip to content

Commit 922cd71

Browse files
committed
FIX: errors in get_position changes
1 parent d5a4eda commit 922cd71

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,9 @@ def get_position(self, original=False):
835835
if original:
836836
return self._originalPosition.frozen()
837837
else:
838-
self.apply_aspect()
838+
locator = self.get_axes_locator()
839+
if not locator:
840+
self.apply_aspect()
839841
return self._position.frozen()
840842

841843
def set_position(self, pos, which='both'):
@@ -857,7 +859,7 @@ def set_position(self, pos, which='both'):
857859
Determines which position variables to change.
858860
859861
"""
860-
self._set_position(pos, which='both')
862+
self._set_position(pos, which=which)
861863
# because this is being called externally to the library we
862864
# zero the constrained layout parts.
863865
self._layoutbox = None

lib/matplotlib/figure.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,10 +2296,10 @@ def get_tightbbox(self, renderer, bbox_extra_artists=None):
22962296
if bbox is not None and (bbox.width != 0 or bbox.height != 0):
22972297
bb.append(bbox)
22982298

2299-
for ax in self.axes:
2300-
if ax.get_visible():
2301-
bb.append(ax.get_tightbbox(renderer, bbox_extra_artists))
2302-
2299+
[bb.append(ax.get_tightbbox(renderer,
2300+
bbox_extra_artists=bbox_extra_artists))
2301+
for ax in self.axes if ax.get_visible()]
2302+
23032303
if len(bb) == 0:
23042304
return self.bbox_inches
23052305

lib/mpl_toolkits/axes_grid1/axes_size.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ def __init__(self, ax, direction):
305305

306306
def __call__(self, renderer):
307307
get_func = self._get_func_map[self._direction]
308-
vl = [get_func(ax.get_tightbbox(renderer, False), ax.bbox)
308+
vl = [get_func(ax.get_tightbbox(renderer, call_axes_locator=False),
309+
ax.bbox)
309310
for ax in self._ax_list]
310311
return max(vl)

lib/mpl_toolkits/axes_grid1/parasite_axes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,10 @@ def _remove_method(h):
327327
return ax2
328328

329329
def get_tightbbox(self, renderer, call_axes_locator=True):
330-
bbs = [ax.get_tightbbox(renderer, call_axes_locator)
330+
bbs = [ax.get_tightbbox(renderer, call_axes_locator=call_axes_locator)
331331
for ax in self.parasites]
332-
bbs.append(super().get_tightbbox(renderer, call_axes_locator))
332+
bbs.append(super().get_tightbbox(renderer,
333+
call_axes_locator=call_axes_locator))
333334
return Bbox.union([b for b in bbs if b.width != 0 or b.height != 0])
334335

335336

0 commit comments

Comments
 (0)
0