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

Method _get_bbox_and_child_offsets

lib/matplotlib/offsetbox.py:449–472  ·  view source on GitHub ↗
(self, renderer)

Source from the content-addressed store, hash-verified

447 """
448
449 def _get_bbox_and_child_offsets(self, renderer):
450 # docstring inherited
451 dpicor = renderer.points_to_pixels(1.)
452 pad = self.pad * dpicor
453 sep = self.sep * dpicor
454
455 if self.width is not None:
456 for c in self.get_visible_children():
457 if isinstance(c, PackerBase) and c.mode == "expand":
458 c.set_width(self.width)
459
460 bboxes = [c.get_bbox(renderer) for c in self.get_visible_children()]
461 (x0, x1), xoffsets = _get_aligned_offsets(
462 [bbox.intervalx for bbox in bboxes], self.width, self.align)
463 height, yoffsets = _get_packed_offsets(
464 [bbox.height for bbox in bboxes], self.height, sep, self.mode)
465
466 yoffsets = height - (yoffsets + [bbox.y1 for bbox in bboxes])
467 ydescent = yoffsets[0]
468 yoffsets = yoffsets - ydescent
469
470 return (
471 Bbox.from_bounds(x0, -ydescent, x1 - x0, height).padded(pad),
472 [*zip(xoffsets, yoffsets)])
473
474
475class HPacker(PackerBase):

Callers

nothing calls this directly

Calls 8

_get_aligned_offsetsFunction · 0.85
_get_packed_offsetsFunction · 0.85
get_visible_childrenMethod · 0.80
paddedMethod · 0.80
from_boundsMethod · 0.80
points_to_pixelsMethod · 0.45
set_widthMethod · 0.45
get_bboxMethod · 0.45

Tested by

no test coverage detected