2626
2727import threading
2828import numpy as np
29-
29+ from math import radians , cos , sin
3030from matplotlib import verbose , rcParams
3131from matplotlib .backend_bases import RendererBase ,\
3232 FigureManagerBase , FigureCanvasBase
@@ -174,10 +174,10 @@ def draw_mathtext(self, gc, x, y, s, prop, angle):
174174 ox , oy , width , height , descent , font_image , used_characters = \
175175 self .mathtext_parser .parse (s , self .dpi , prop )
176176
177- xd = descent * np . sin (np . deg2rad (angle ))
178- yd = descent * np . cos (np . deg2rad (angle ))
179- x = np . round (x + ox + xd )
180- y = np . round (y - oy + yd )
177+ xd = descent * sin (radians (angle ))
178+ yd = descent * cos (radians (angle ))
179+ x = round (x + ox + xd )
180+ y = round (y - oy + yd )
181181 self ._renderer .draw_text_image (font_image , x , y + 1 , angle , gc )
182182
183183 def draw_text (self , gc , x , y , s , prop , angle , ismath = False , mtext = None ):
@@ -204,12 +204,12 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
204204 xo , yo = font .get_bitmap_offset ()
205205 xo /= 64.0
206206 yo /= 64.0
207- xd = - d * np . sin (np . deg2rad (angle ))
208- yd = d * np . cos (np . deg2rad (angle ))
207+ xd = - d * sin (radians (angle ))
208+ yd = d * cos (radians (angle ))
209209
210210 #print x, y, int(x), int(y), s
211211 self ._renderer .draw_text_image (
212- font , np . round (x - xd + xo ), np . round (y + yd + yo ) + 1 , angle , gc )
212+ font , round (x - xd + xo ), round (y + yd + yo ) + 1 , angle , gc )
213213
214214 def get_text_width_height_descent (self , s , prop , ismath ):
215215 """
@@ -254,10 +254,10 @@ def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!', mtext=None):
254254 Z = np .array (Z * 255.0 , np .uint8 )
255255
256256 w , h , d = self .get_text_width_height_descent (s , prop , ismath )
257- xd = d * np . sin (np . deg2rad (angle ))
258- yd = d * np . cos (np . deg2rad (angle ))
259- x = np . round (x + xd )
260- y = np . round (y + yd )
257+ xd = d * sin (radians (angle ))
258+ yd = d * cos (radians (angle ))
259+ x = round (x + xd )
260+ y = round (y + yd )
261261
262262 self ._renderer .draw_text_image (Z , x , y , angle , gc )
263263
0 commit comments