@@ -36,7 +36,7 @@ def _fn_name(): return sys._getframe(1).f_code.co_name
3636from matplotlib .backends .backend_mixed import MixedModeRenderer
3737
3838
39- import numpy as npy
39+ import numpy as np
4040import binascii
4141import re
4242try :
@@ -127,7 +127,7 @@ def seq_allequal(seq1, seq2):
127127 #ok, neither are None:, assuming iterable
128128
129129 if len (seq1 ) != len (seq2 ): return False
130- return npy .alltrue (npy .equal (seq1 , seq2 ))
130+ return np .alltrue (np .equal (seq1 , seq2 ))
131131
132132
133133class RendererPS (RendererBase ):
@@ -348,20 +348,20 @@ def _rgba(self, im):
348348 def _rgb (self , im ):
349349 h ,w ,s = im .as_rgba_str ()
350350
351- rgba = npy .fromstring (s , npy .uint8 )
351+ rgba = np .fromstring (s , np .uint8 )
352352 rgba .shape = (h , w , 4 )
353353 rgb = rgba [:,:,:3 ]
354354 return h , w , rgb .tostring ()
355355
356356 def _gray (self , im , rc = 0.3 , gc = 0.59 , bc = 0.11 ):
357357 rgbat = im .as_rgba_str ()
358- rgba = npy .fromstring (rgbat [2 ], npy .uint8 )
358+ rgba = np .fromstring (rgbat [2 ], np .uint8 )
359359 rgba .shape = (rgbat [0 ], rgbat [1 ], 4 )
360- rgba_f = rgba .astype (npy .float32 )
360+ rgba_f = rgba .astype (np .float32 )
361361 r = rgba_f [:,:,0 ]
362362 g = rgba_f [:,:,1 ]
363363 b = rgba_f [:,:,2 ]
364- gray = (r * rc + g * gc + b * bc ).astype (npy .uint8 )
364+ gray = (r * rc + g * gc + b * bc ).astype (np .uint8 )
365365 return rgbat [0 ], rgbat [1 ], gray .tostring ()
366366
367367 def _hex_lines (self , s , chars_per_line = 128 ):
@@ -811,14 +811,14 @@ def draw_gouraud_triangles(self, gc, points, colors, trans):
811811 shape = points .shape
812812 flat_points = points .reshape ((shape [0 ] * shape [1 ], 2 ))
813813 flat_colors = colors .reshape ((shape [0 ] * shape [1 ], 4 ))
814- points_min = npy .min (flat_points , axis = 0 ) - (1 << 8 )
815- points_max = npy .max (flat_points , axis = 0 ) + (1 << 8 )
814+ points_min = np .min (flat_points , axis = 0 ) - (1 << 8 )
815+ points_max = np .max (flat_points , axis = 0 ) + (1 << 8 )
816816 factor = float (0xffffffff ) / (points_max - points_min )
817817
818818 xmin , ymin = points_min
819819 xmax , ymax = points_max
820820
821- streamarr = npy .empty (
821+ streamarr = np .empty (
822822 (shape [0 ] * shape [1 ],),
823823 dtype = [('flags' , 'u1' ),
824824 ('points' , '>u4' , (2 ,)),
@@ -1492,7 +1492,7 @@ def get_bbox_header(l, b, r, t):
14921492 return a postscript header stringfor the given bbox (l, b, r, t)
14931493 """
14941494
1495- bbox_info = '%%%%BoundingBox: %d %d %d %d' % (l , b , npy .ceil (r ), npy .ceil (t ))
1495+ bbox_info = '%%%%BoundingBox: %d %d %d %d' % (l , b , np .ceil (r ), np .ceil (t ))
14961496 hires_bbox_info = '%%%%HiResBoundingBox: %.6f %.6f %.6f %.6f' % (l , b , r , t )
14971497
14981498 return '\n ' .join ([bbox_info , hires_bbox_info ])
@@ -1537,7 +1537,7 @@ def get_bbox(tmpfile, bbox):
15371537 dy = (bbox [3 ]- bbox [1 ])/ 2
15381538 l ,b ,r ,t = (x - dx , y - dy , x + dx , y + dy )
15391539
1540- bbox_info = '%%%%BoundingBox: %d %d %d %d' % (l , b , npy .ceil (r ), npy .ceil (t ))
1540+ bbox_info = '%%%%BoundingBox: %d %d %d %d' % (l , b , np .ceil (r ), np .ceil (t ))
15411541 hires_bbox_info = '%%%%HiResBoundingBox: %.6f %.6f %.6f %.6f' % (l , b , r , t )
15421542
15431543 return '\n ' .join ([bbox_info , hires_bbox_info ])
0 commit comments