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 5da9ed5

Browse filesBrowse files
committed
Merge pull request #5356 from Tillsten/ticker_maint
Replace numpy funcs for scalars.
1 parent a450f99 commit 5da9ed5
Copy full SHA for 5da9ed5

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+12
-12
lines changed

‎lib/matplotlib/backends/backend_agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_agg.py
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import threading
2828
import numpy as np
29-
29+
from math import radians, cos, sin
3030
from matplotlib import verbose, rcParams
3131
from 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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.