Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47554ec

Browse files
committed
Now uses np.deg2rad instead of manually transforming degrees to radiants
1 parent d5a1a3d commit 47554ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/text.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _get_textbox(text, renderer):
115115
projected_xs = []
116116
projected_ys = []
117117

118-
theta = text.get_rotation() / 180. * math.pi
118+
theta = np.deg2rad(text.get_rotation())
119119
tr = mtransforms.Affine2D().rotate(-theta)
120120

121121
for t, wh, x, y in text._get_layout(renderer)[1]:
@@ -507,7 +507,7 @@ def update_bbox_position_size(self, renderer):
507507
x_box, y_box, w_box, h_box = _get_textbox(self, renderer)
508508
self._bbox_patch.set_bounds(0., 0.,
509509
w_box, h_box)
510-
theta = self.get_rotation() / 180. * math.pi
510+
theta = np.deg2rad(self.get_rotation())
511511
tr = mtransforms.Affine2D().rotate(theta)
512512
tr = tr.translate(posx + x_box, posy + y_box)
513513
self._bbox_patch.set_transform(tr)
@@ -524,7 +524,7 @@ def _draw_bbox(self, renderer, posx, posy):
524524
x_box, y_box, w_box, h_box = _get_textbox(self, renderer)
525525
self._bbox_patch.set_bounds(0., 0.,
526526
w_box, h_box)
527-
theta = self.get_rotation() / 180. * math.pi
527+
theta = np.deg2rad(self.get_rotation())
528528
tr = mtransforms.Affine2D().rotate(theta)
529529
tr = tr.translate(posx + x_box, posy + y_box)
530530
self._bbox_patch.set_transform(tr)

0 commit comments

Comments
 (0)