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

Method update_bbox_position_size

lib/matplotlib/text.py:659–680  ·  view source on GitHub ↗

Update the location and the size of the bbox. This method should be used when the position and size of the bbox needs to be updated before actually drawing the bbox.

(self, renderer)

Source from the content-addressed store, hash-verified

657 return self._bbox_patch
658
659 def update_bbox_position_size(self, renderer):
660 """
661 Update the location and the size of the bbox.
662
663 This method should be used when the position and size of the bbox needs
664 to be updated before actually drawing the bbox.
665 """
666 if self._bbox_patch:
667 # don't use self.get_unitless_position here, which refers to text
668 # position in Text:
669 posx = float(self.convert_xunits(self._x))
670 posy = float(self.convert_yunits(self._y))
671 posx, posy = self.get_transform().transform((posx, posy))
672
673 _, _, ((x_box, y_box), (w_box, h_box)) = self._get_layout(renderer)
674 self._bbox_patch.set_bounds(0., 0., w_box, h_box)
675 self._bbox_patch.set_transform(
676 Affine2D()
677 .rotate_deg(self.get_rotation())
678 .translate(posx + x_box, posy + y_box))
679 fontsize_in_pixel = renderer.points_to_pixels(self.get_size())
680 self._bbox_patch.set_mutation_scale(fontsize_in_pixel)
681
682 def _update_clip_properties(self):
683 if self._bbox_patch:

Callers 2

drawMethod · 0.95
drawMethod · 0.80

Calls 14

_get_layoutMethod · 0.95
get_rotationMethod · 0.95
Affine2DClass · 0.85
convert_xunitsMethod · 0.80
convert_yunitsMethod · 0.80
translateMethod · 0.80
rotate_degMethod · 0.80
transformMethod · 0.45
get_transformMethod · 0.45
set_boundsMethod · 0.45
set_transformMethod · 0.45
points_to_pixelsMethod · 0.45

Tested by

no test coverage detected