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

Method _get_anchored_bbox

lib/matplotlib/legend.py:1160–1178  ·  view source on GitHub ↗

Place the *bbox* inside the *parentbbox* according to a given location code. Return the (x, y) coordinate of the bbox. Parameters ---------- loc : int A location code in range(1, 11). This corresponds to the possible values for ``self

(self, loc, bbox, parentbbox, renderer)

Source from the content-addressed store, hash-verified

1158 self.stale = True
1159
1160 def _get_anchored_bbox(self, loc, bbox, parentbbox, renderer):
1161 """
1162 Place the *bbox* inside the *parentbbox* according to a given
1163 location code. Return the (x, y) coordinate of the bbox.
1164
1165 Parameters
1166 ----------
1167 loc : int
1168 A location code in range(1, 11). This corresponds to the possible
1169 values for ``self._loc``, excluding "best".
1170 bbox : `~matplotlib.transforms.Bbox`
1171 bbox to be placed, in display coordinates.
1172 parentbbox : `~matplotlib.transforms.Bbox`
1173 A parent box which will contain the bbox, in display coordinates.
1174 """
1175 pad = self.borderaxespad * renderer.points_to_pixels(self._fontsize)
1176 return offsetbox._get_anchored_bbox(
1177 loc, bbox, parentbbox,
1178 pad, pad)
1179
1180 def _find_best_position(self, width, height, renderer):
1181 """Determine the best location to place the legend."""

Callers 2

_findoffsetMethod · 0.95
_find_best_positionMethod · 0.95

Calls 1

points_to_pixelsMethod · 0.45

Tested by

no test coverage detected