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

Method get_patch_transform

lib/matplotlib/patches.py:906–925  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

904 return x0, y0, x1, y1
905
906 def get_patch_transform(self):
907 # Note: This cannot be called until after this has been added to
908 # an Axes, otherwise unit conversion will fail. This makes it very
909 # important to call the accessor method and not directly access the
910 # transformation member variable.
911 bbox = self.get_bbox()
912 if self.rotation_point == 'center':
913 width, height = bbox.x1 - bbox.x0, bbox.y1 - bbox.y0
914 rotation_point = bbox.x0 + width / 2., bbox.y0 + height / 2.
915 elif self.rotation_point == 'xy':
916 rotation_point = bbox.x0, bbox.y0
917 else:
918 rotation_point = self.rotation_point
919 return transforms.BboxTransformTo(bbox) \
920 + transforms.Affine2D() \
921 .translate(-rotation_point[0], -rotation_point[1]) \
922 .scale(1, self._aspect_ratio_correction) \
923 .rotate_deg(self.angle) \
924 .scale(1, 1 / self._aspect_ratio_correction) \
925 .translate(*rotation_point)
926
927 @property
928 def rotation_point(self):

Callers 2

get_cornersMethod · 0.95
get_centerMethod · 0.95

Calls 4

get_bboxMethod · 0.95
translateMethod · 0.80
rotate_degMethod · 0.80
scaleMethod · 0.45

Tested by

no test coverage detected