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

Function get_pos_and_bbox

lib/matplotlib/_constrained_layout.py:617–642  ·  view source on GitHub ↗

Get the position and the bbox for the Axes. Parameters ---------- ax : `~matplotlib.axes.Axes` renderer : `~matplotlib.backend_bases.RendererBase` subclass. Returns ------- pos : `~matplotlib.transforms.Bbox` Position in figure coordinates. bbox : `~mat

(ax, renderer)

Source from the content-addressed store, hash-verified

615
616
617def get_pos_and_bbox(ax, renderer):
618 """
619 Get the position and the bbox for the Axes.
620
621 Parameters
622 ----------
623 ax : `~matplotlib.axes.Axes`
624 renderer : `~matplotlib.backend_bases.RendererBase` subclass.
625
626 Returns
627 -------
628 pos : `~matplotlib.transforms.Bbox`
629 Position in figure coordinates.
630 bbox : `~matplotlib.transforms.Bbox`
631 Tight bounding box in figure coordinates.
632 """
633 fig = ax.get_figure(root=False)
634 pos = ax.get_position(original=True)
635 # pos is in panel co-ords, but we need in figure for the layout
636 pos = pos.transformed(fig.transSubfigure - fig.transFigure)
637 tightbbox = martist._get_tightbbox_for_layout_only(ax, renderer)
638 if tightbbox is None:
639 bbox = pos
640 else:
641 bbox = tightbbox.transformed(fig.transFigure.inverted())
642 return pos, bbox
643
644
645def reposition_axes(layoutgrids, fig, renderer, *,

Callers 2

make_layout_marginsFunction · 0.85
reposition_colorbarFunction · 0.85

Calls 4

get_figureMethod · 0.45
get_positionMethod · 0.45
transformedMethod · 0.45
invertedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…