10000 Avoid setting SubFigure.bbox_relative to None · matplotlib/matplotlib@8366bf4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8366bf4

Browse files
committed
Avoid setting SubFigure.bbox_relative to None
It's only there for `__init__` and immediately changed right after.
1 parent 85885a4 commit 8366bf4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/matplotlib/figure.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ def __init__(self, parent, subplotspec, *,
22132213
self._axobservers = parent._axobservers
22142214
self.canvas = parent.canvas
22152215
self.transFigure = parent.transFigure
2216-
self.bbox_relative = None
2216+
self.bbox_relative = Bbox.null()
22172217
self._redo_transform_rel_fig()
22182218
self.figbbox = self._parent.figbbox
22192219
self.bbox = TransformedBbox(self.bbox_relative,
@@ -2278,11 +2278,8 @@ def _redo_transform_rel_fig(self, bbox=None):
22782278
dy = hr[self._subplotspec.rowspan].sum() / hr.sum()
22792279
x0 = wr[:self._subplotspec.colspan.start].sum() / wr.sum()
22802280
y0 = 1 - hr[:self._subplotspec.rowspan.stop].sum() / hr.sum()
2281-
if self.bbox_relative is None:
2282-
self.bbox_relative = Bbox.from_bounds(x0, y0, dx, dy)
2283-
else:
2284-
self.bbox_relative.p0 = (x0, y0)
2285-
self.bbox_relative.p1 = (x0 + dx, y0 + dy)
2281+
self.bbox_relative.p0 = (x0, y0)
2282+
self.bbox_relative.p1 = (x0 + dx, y0 + dy)
22862283

22872284
def get_constrained_layout(self):
22882285
"""

0 commit comments

Comments
 (0)
0