8000 FIX: allow non bbox_extra_artists calls · matplotlib/matplotlib@b9f79b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit b9f79b5

Browse files
committed
FIX: allow non bbox_extra_artists calls
1 parent e4ba4f2 commit b9f79b5

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

lib/matplotlib/figure.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,9 +2296,16 @@ 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-
bb.extend(
2300-
ax.get_tightbbox(renderer, bbox_extra_artists=bbox_extra_artists)
2301-
for ax in self.axes if ax.get_visible())
2299+
for ax in self.axes:
2300+
if ax.get_visible():
2301+
# some axes don't take the bbox_extra_artists kwarg so we
2302+
# need this conditional....
2303+
try:
2304+
bbox = ax.get_tightbbox(renderer,
2305+
bbox_extra_artists=bbox_extra_artists)
2306+
except TypeError:
2307+
bbox = ax.get_tightbbox(renderer)
2308+
bb.append(bbox)
23022309

23032310
if len(bb) == 0:
23042311
return self.bbox_inches

lib/mpl_toolkits/axes_grid1/parasite_axes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,13 @@ def _remove_method(h):
326326

327327
return ax2
328328

329-
def get_tightbbox(self, renderer, call_axes_locator=True):
329+
def get_tightbbox(self, renderer, call_axes_locator=True,
330+
bbox_extra_artists=None):
330331
bbs = [ax.get_tightbbox(renderer, call_axes_locator=call_axes_locator)
331332
for ax in self.parasites]
332333
bbs.append(super().get_tightbbox(renderer,
333-
call_axes_locator=call_axes_locator))
334+
call_axes_locator=call_axes_locator,
335+
bbox_extra_artists=bbox_extra_artists))
334336
return Bbox.union([b for b in bbs if b.width != 0 or b.height != 0])
335337

336338

0 commit comments

Comments
 (0)
0