@@ -38,7 +38,7 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
3838from matplotlib .cbook import enumerate , izip
3939from matplotlib .figure import Figure
4040from matplotlib .mathtext import math_parse_s_ft2font
41- import matplotlib . numerix as numx
41+ import numpy as npy
4242from matplotlib .transforms import Bbox
4343from matplotlib import rcParams
4444
@@ -137,8 +137,8 @@ def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2,
137137 ctx .rotate (rotation )
138138 ctx .scale (width / 2.0 , height / 2.0 )
139139 ctx .new_sub_path ()
140- ctx .arc (0.0 , 0.0 , 1.0 , numx .pi * angle1 / 180. ,
141- numx .pi * angle2 / 180. )
140+ ctx .arc (0.0 , 0.0 , 1.0 , npy .pi * angle1 / 180. ,
141+ npy .pi * angle2 / 180. )
142142 ctx .restore ()
143143
144144 self ._fill_and_stroke (ctx , rgbFace )
@@ -243,7 +243,7 @@ def draw_point(self, gc, x, y):
243243 # render by drawing a 0.5 radius circle
244244 ctx = gc .ctx
245245 ctx .new_path ()
246- ctx .arc (x , self .height - y , 0.5 , 0 , 2 * numx .pi )
246+ ctx .arc (x , self .height - y , 0.5 , 0 , 2 * npy .pi )
247247 self ._fill_and_stroke (ctx , gc .get_rgb ())
248248
249249
@@ -294,7 +294,7 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False):
294294
295295 ctx .save ()
296296 if angle :
297- ctx .rotate (- angle * numx .pi / 180 )
297+ ctx .rotate (- angle * npy .pi / 180 )
298298 ctx .set_font_size (size )
299299 ctx .show_text (s )
300300 ctx .restore ()
@@ -304,7 +304,7 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
304304 if _debug : print '%s.%s()' % (self .__class__ .__name__ , _fn_name ())
305305 # mathtext using the gtk/gdk method
306306
307- #if numx .which[0] == "numarray":
307+ #if npy .which[0] == "numarray":
308308 # warnings.warn("_draw_mathtext() currently works for numpy, but "
309309 # "not numarray")
310310 # return
@@ -327,21 +327,21 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
327327 N = imw * imh
328328
329329 # a numpixels by num fonts array
330- Xall = numx .zeros ((N ,len (fonts )), typecode = numx . UInt8 )
330+ Xall = npy .zeros ((N ,len (fonts )), npy . uint8 )
331331
332332 for i , font in enumerate (fonts ):
333333 if angle == 90 :
334334 font .horiz_image_to_vert_image () # <-- Rotate
335335 imw , imh , s = font .image_as_str ()
336- Xall [:,i ] = numx .fromstring (s , numx . UInt8 )
336+ Xall [:,i ] = npy .fromstring (s , npy . uint8 )
337337
338338 # get the max alpha at each pixel
339- Xs = numx .mlab .max (Xall ,1 )
339+ Xs = npy .mlab .max (Xall ,1 )
340340
341341 # convert it to it's proper shape
342342 Xs .shape = imh , imw
343343
344- pa = numx .zeros (shape = (imh ,imw ,4 ), typecode = numx . UInt8 )
344+ pa = npy .zeros ((imh ,imw ,4 ), npy . uint8 )
345345 rgb = gc .get_rgb ()
346346 pa [:,:,0 ] = int (rgb [0 ]* 255 )
347347 pa [:,:,1 ] = int (rgb [1 ]* 255 )
@@ -469,7 +469,7 @@ def set_dashes(self, offset, dashes):
469469 self .ctx .set_dash ([], 0 ) # switch dashes off
470470 else :
471471 self .ctx .set_dash (
472- self .renderer .points_to_pixels (numx .asarray (dashes )), offset )
472+ self .renderer .points_to_pixels (npy .asarray (dashes )), offset )
473473
474474
475475 def set_foreground (self , fg , isRGB = None ):
@@ -593,7 +593,7 @@ def _save (self, fo, format, orientation, **kwargs):
593593 ctx = renderer .ctx
594594
595595 if orientation == 'landscape' :
596- ctx .rotate (numx .pi / 2 )
596+ ctx .rotate (npy .pi / 2 )
597597 ctx .translate (0 , - height_in_points )
598598 # cairo/src/cairo_ps_surface.c
599599 # '%%Orientation: Portrait' is always written to the file header
0 commit comments