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

Method get_offset

lib/matplotlib/offsetbox.py:1061–1079  ·  view source on GitHub ↗
(self, bbox, renderer)

Source from the content-addressed store, hash-verified

1059
1060 @_compat_get_offset
1061 def get_offset(self, bbox, renderer):
1062 # docstring inherited
1063 fontsize_in_pixels = renderer.points_to_pixels(self.prop.get_size_in_points())
1064 try:
1065 borderpad_x, borderpad_y = self.borderpad
1066 except TypeError:
1067 borderpad_x = self.borderpad
1068 borderpad_y = self.borderpad
1069 pad_x_pixels = borderpad_x * fontsize_in_pixels
1070 pad_y_pixels = borderpad_y * fontsize_in_pixels
1071 bbox_to_anchor = self.get_bbox_to_anchor()
1072 x0, y0 = _get_anchored_bbox(
1073 self.loc,
1074 Bbox.from_bounds(0, 0, bbox.width, bbox.height),
1075 bbox_to_anchor,
1076 pad_x_pixels,
1077 pad_y_pixels
1078 )
1079 return x0 - bbox.x0, y0 - bbox.y0
1080
1081 def update_frame(self, bbox, fontsize=None):
1082 self.patch.set_bounds(bbox.bounds)

Callers 1

drawMethod · 0.95

Calls 4

get_bbox_to_anchorMethod · 0.95
_get_anchored_bboxFunction · 0.85
from_boundsMethod · 0.80
points_to_pixelsMethod · 0.45

Tested by

no test coverage detected