Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47554ec

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

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+3-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.