MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _redo_transform_rel_fig

Method _redo_transform_rel_fig

lib/matplotlib/figure.py:2341–2364  ·  view source on GitHub ↗

Make the transSubfigure bbox relative to Figure transform. Parameters ---------- bbox : bbox or None If not None, then the bbox is used for relative bounding box. Otherwise, it is calculated from the subplotspec.

(self, bbox=None)

Source from the content-addressed store, hash-verified

2339 return self._parent._get_renderer()
2340
2341 def _redo_transform_rel_fig(self, bbox=None):
2342 """
2343 Make the transSubfigure bbox relative to Figure transform.
2344
2345 Parameters
2346 ----------
2347 bbox : bbox or None
2348 If not None, then the bbox is used for relative bounding box.
2349 Otherwise, it is calculated from the subplotspec.
2350 """
2351 if bbox is not None:
2352 self.bbox_relative.p0 = bbox.p0
2353 self.bbox_relative.p1 = bbox.p1
2354 return
2355 # need to figure out *where* this subplotspec is.
2356 gs = self._subplotspec.get_gridspec()
2357 wr = np.asarray(gs.get_width_ratios())
2358 hr = np.asarray(gs.get_height_ratios())
2359 dx = wr[self._subplotspec.colspan].sum() / wr.sum()
2360 dy = hr[self._subplotspec.rowspan].sum() / hr.sum()
2361 x0 = wr[:self._subplotspec.colspan.start].sum() / wr.sum()
2362 y0 = 1 - hr[:self._subplotspec.rowspan.stop].sum() / hr.sum()
2363 self.bbox_relative.p0 = (x0, y0)
2364 self.bbox_relative.p1 = (x0 + dx, y0 + dy)
2365
2366 def get_constrained_layout(self):
2367 """

Callers 3

__init__Method · 0.95
reposition_axesFunction · 0.80
subfiguresMethod · 0.80

Calls 3

get_width_ratiosMethod · 0.80
get_height_ratiosMethod · 0.80
get_gridspecMethod · 0.45

Tested by

no test coverage detected