1616from artist import Artist , setp
1717from axis import XAxis , YAxis
1818from cbook import iterable , is_string_like , flatten , enumerate , \
19- allequal , dict_delall , popd , popall , silent_list , is_numlike , dedent
19+ allequal , dict_delall , popall , silent_list , is_numlike , dedent
2020from collections import RegularPolyCollection , PolyCollection , LineCollection , \
2121 QuadMesh , StarPolygonCollection , BrokenBarHCollection
2222from colors import colorConverter , Normalize , Colormap , \
@@ -203,16 +203,15 @@ def _get_next_cycle_color(self):
203203 return color
204204
205205 def __call__ (self , * args , ** kwargs ):
206- kwargs = kwargs .copy ()
207206
208207 if self .axes .xaxis is not None and self .axes .xaxis is not None :
209- xunits = popd ( kwargs , 'xunits' , self .axes .xaxis .units )
210- yunits = popd ( kwargs , 'yunits' , self .axes .yaxis .units )
208+ xunits = kwargs . pop ( 'xunits' , self .axes .xaxis .units )
209+ yunits = kwargs . pop ( 'yunits' , self .axes .yaxis .units )
211210 if xunits != self .axes .xaxis .units :
212211 self .axes .xaxis .set_units (xunits )
213212 if yunits != self .axes .yaxis .units :
214213 self .axes .yaxis .set_units (yunits )
215-
214+
216215 ret = self ._grab_next_args (* args , ** kwargs )
217216 return ret
218217
@@ -238,7 +237,7 @@ def _xy_from_y(self, y):
238237 if self .axes .yaxis is not None :
239238 b = self .axes .yaxis .update_units (y )
240239 if b : return arange (len (y )), y , False
241-
240+
242241 y = ma .asarray (y )
243242 if len (y .shape ) == 1 :
244243 y = y [:,newaxis ]
@@ -249,12 +248,12 @@ def _xy_from_y(self, y):
249248 return x ,y , True
250249
251250 def _xy_from_xy (self , x , y ):
252- if self .axes .xaxis is not None and self .axes .yaxis is not None :
251+ if self .axes .xaxis is not None and self .axes .yaxis is not None :
253252 bx = self .axes .xaxis .update_units (x )
254253 by = self .axes .yaxis .update_units (y )
255254 # right now multicol is not supported if either x or y are
256255 # unit enabled but this can be fixed..
257- if bx or by : return x , y , False
256+ if bx or by : return x , y , False
258257
259258 x = ma .asarray (x )
260259 y = ma .asarray (y )
@@ -366,7 +365,6 @@ def makefill(x, y):
366365 return ret
367366
368367 def _plot_3_args (self , tup3 , ** kwargs ):
369- kwargs = kwargs .copy ()
370368 ret = []
371369
372370 x , y , fmt = tup3
@@ -1046,7 +1044,7 @@ def add_collection(self, collection, autolim=False):
10461044 if autolim :
10471045 self .update_datalim (collection .get_verts (self .transData ))
10481046
1049-
1047+
10501048 def add_line (self , line ):
10511049 'Add a line to the list of plot lines'
10521050 self ._set_artist_props (line )
@@ -1068,7 +1066,7 @@ def _update_line_limits(self, line):
10681066 ydata = array ([y for x ,y in xys ])
10691067
10701068 self .update_datalim_numerix ( xdata , ydata )
1071-
1069+
10721070
10731071 def add_patch (self , p ):
10741072 """
@@ -1081,7 +1079,7 @@ def add_patch(self, p):
10811079 p .set_clip_box (self .bbox )
10821080 self ._update_patch_limits (p )
10831081 self .patches .append (p )
1084-
1082+
10851083 def _update_patch_limits (self , p ):
10861084 'update the datalimits for patch p'
10871085 xys = self ._get_verts_in_data_coords (
@@ -1102,7 +1100,7 @@ def relim(self):
11021100
11031101 for p in self .patches :
11041102 self ._update_patch_limits (patch )
1105-
1103+
11061104 def update_datalim (self , xys ):
11071105 'Update the data lim bbox with seq of xy tups or equiv. 2-D array'
11081106 # if no data is set currently, the bbox will ignore its
@@ -1135,25 +1133,25 @@ def _get_verts_in_data_coords(self, trans, xys):
11351133 def _process_unit_info (self , xdata = None , ydata = None , kwargs = None ):
11361134 'look for unit kwargs and update the axis instances as necessary'
11371135
1138- if self .xaxis is None or self .xaxis is None : return
1136+ if self .xaxis is None or self .xaxis is None : return
11391137
11401138
11411139 if xdata is not None :
11421140 self .xaxis .update_units (xdata )
11431141 #print '_process updated xdata: units=%s, converter=%s'%(self.xaxis.units, self.xaxis.converter)
11441142
11451143 if ydata is not None :
1146- self .yaxis .update_units (ydata )
1147- #print '_process updated ydata: units=%s, converter=%s'%(self.yaxis.units, self.yaxis.converter)
1144+ self .yaxis .update_units (ydata )
1145+ #print '_process updated ydata: units=%s, converter=%s'%(self.yaxis.units, self.yaxis.converter)
11481146
11491147 # process kwargs 2nd since these will override default units
11501148 if kwargs is not None :
1151- xunits = popd ( kwargs , 'xunits' , self .xaxis .units )
1149+ xunits = kwargs . pop ( 'xunits' , self .xaxis .units )
11521150 if xunits != self .xaxis .units :
11531151 self .xaxis .set_units (xunits )
11541152 #print '_process updated xunits kws: units=%s, converter=%s'%(self.xaxis.units, self.xaxis.converter)
11551153
1156- yunits = popd ( kwargs , 'yunits' , self .yaxis .units )
1154+ yunits = kwargs . pop ( 'yunits' , self .yaxis .units )
11571155 if yunits != self .yaxis .units :
11581156 self .yaxis .set_units (yunits )
11591157 #print '_process updated yunits kws: units=%s, converter=%s'%(self.yaxis.units, self.yaxis.converter)
@@ -2241,7 +2239,6 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
22412239 %(Polygon)s
22422240 """
22432241 # convert y axis units
2244- kwargs = kwargs .copy ()
22452242
22462243 trans = blend_xy_sep_transform ( self .transAxes , self .transData )
22472244 verts = (xmin , ymin ), (xmin , ymax ), (xmax , ymax ), (xmax , ymin )
@@ -2283,7 +2280,6 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
22832280 %(Polygon)s
22842281 """
22852282 # convert x axis units
2286- kwargs = kwargs .copy ()
22872283 trans = blend_xy_sep_transform ( self .transData , self .transAxes )
22882284 verts = [(xmin , ymin ), (xmin , ymax ), (xmax , ymax ), (xmax , ymin )]
22892285 p = Polygon (verts , ** kwargs )
@@ -2507,17 +2503,16 @@ def plot(self, *args, **kwargs):
25072503 information
25082504 """
25092505
2510- kwargs = kwargs .copy ()
2511- scalex = popd (kwargs , 'scalex' , True )
2512- scaley = popd (kwargs , 'scaley' , True )
2506+ scalex = kwargs .pop ('scalex' , True )
2507+ scaley = kwargs .pop ('scaley' , True )
25132508
25142509 if not self ._hold : self .cla ()
25152510 lines = []
25162511
25172512 for line in self ._get_lines (* args , ** kwargs ):
25182513 self .add_line (line )
25192514 lines .append (line )
2520-
2515+
25212516
25222517 self .autoscale_view (scalex = scalex , scaley = scaley )
25232518 return lines
@@ -2605,12 +2600,11 @@ def loglog(self, *args, **kwargs):
26052600 %(Line2D)s
26062601 """
26072602 if not self ._hold : self .cla ()
2608- kwargs = kwargs .copy ()
2609- dx = {'basex' : popd (kwargs ,'basex' , 10 ),
2610- 'subsx' : popd (kwargs ,'subsx' , None ),
2603+ dx = {'basex' : kwargs .pop ('basex' , 10 ),
2604+ 'subsx' : kwargs .pop ('subsx' , None ),
26112605 }
2612- dy = {'basey' : popd ( kwargs , 'basey' , 10 ),
2613- 'subsy' : popd ( kwargs , 'subsy' , None ),
2606+ dy = {'basey' : kwargs . pop ( 'basey' , 10 ),
2607+ 'subsy' : kwargs . pop ( 'subsy' , None ),
26142608 }
26152609
26162610 self .set_xscale ('log' , ** dx )
@@ -2645,9 +2639,8 @@ def semilogx(self, *args, **kwargs):
26452639 %(Line2D)s
26462640 """
26472641 if not self ._hold : self .cla ()
2648- kwargs = kwargs .copy ()
2649- d = {'basex' : popd (kwargs , 'basex' , 10 ),
2650- 'subsx' : popd (kwargs , 'subsx' , None ),
2642+ d = {'basex' : kwargs .pop ('basex' , 10 ),
2643+ 'subsx' : kwargs .pop ('subsx' , None ),
26512644 }
26522645
26532646 self .set_xscale ('log' , ** d )
@@ -2680,9 +2673,8 @@ def semilogy(self, *args, **kwargs):
26802673
26812674 """
26822675 if not self ._hold : self .cla ()
2683- kwargs = kwargs .copy ()
2684- d = {'basey' : popd (kwargs ,'basey' , 10 ),
2685- 'subsy' : popd (kwargs ,'subsy' , None ),
2676+ d = {'basey' : kwargs .pop ('basey' , 10 ),
2677+ 'subsy' : kwargs .pop ('subsy' , None ),
26862678 }
26872679 self .set_yscale ('log' , ** d )
26882680 b = self ._hold
@@ -2787,7 +2779,6 @@ def xcorr(self, x, y, normed=False, detrend=detrend_none, usevlines=False,
27872779 a = self .vlines (lags , [0 ], c , ** kwargs )
27882780 b = self .axhline (** kwargs )
27892781 else :
2790- kwargs = kwargs .copy ()
27912782 kwargs .setdefault ('marker' , 'o' )
27922783 kwargs .setdefault ('linestyle' , 'None' )
27932784 a , = self .plot (lags , c , ** kwargs )
@@ -2859,7 +2850,6 @@ def legend(self, *args, **kwargs):
28592850 handletextsep = 0.02 # the space between the legend line and legend text
28602851 axespad = 0.02 # the border between the axes and legend edge
28612852 """
2862- kwargs = kwargs .copy ()
28632853 def get_handles ():
28642854 handles = self .lines
28652855 handles .extend (self .patches )
@@ -2876,13 +2866,13 @@ def get_handles():
28762866 if label != '_nolegend_' :
28772867 handles .append (line )
28782868 labels .append (label )
2879- loc = popd ( kwargs , 'loc' , 1 )
2869+ loc = kwargs . pop ( 'loc' , 1 )
28802870
28812871 elif len (args )== 1 :
28822872 # LABELS
28832873 labels = args [0 ]
28842874 handles = [h for h , label in zip (get_handles (), labels )]
2885- loc = popd ( kwargs , 'loc' , 1 )
2875+ loc = kwargs . pop ( 'loc' , 1 )
28862876
28872877 elif len (args )== 2 :
28882878 if is_string_like (args [1 ]) or isinstance (args [1 ], int ):
@@ -2892,7 +2882,7 @@ def get_handles():
28922882 else :
28932883 # LINES, LABELS
28942884 handles , labels = args
2895- loc = popd ( kwargs , 'loc' , 1 )
2885+ loc = kwargs . pop ( 'loc' , 1 )
28962886
28972887 elif len (args )== 3 :
28982888 # LINES, LABELS, LOC
@@ -3776,7 +3766,6 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
37763766 '8' : (8 ,0 ), # octagon
37773767 }
37783768
3779- kwargs = kwargs .copy ()
37803769 self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
37813770
37823771 x , y , s , c = delete_masked_points (x , y , s , c )
@@ -4068,15 +4057,14 @@ def quiver_classic(self, U, V, *args, **kwargs ):
40684057 V = V * (S / Nmax )
40694058 N = N * Nmax
40704059
4071- kwargs = kwargs .copy ()
4072- alpha = popd (kwargs ,'alpha' , 1.0 )
4073- width = popd (kwargs ,'width' , .5 )
4074- norm = popd (kwargs ,'norm' , None )
4075- cmap = popd (kwargs ,'cmap' , None )
4076- vmin = popd (kwargs ,'vmin' , None )
4077- vmax = popd (kwargs ,'vmax' , None )
4078- color = popd (kwargs ,'color' , None )
4079- shading = popd (kwargs ,'shading' , 'faceted' )
4060+ alpha = kwargs .pop ('alpha' , 1.0 )
4061+ width = kwargs .pop ('width' , .5 )
4062+ norm = kwargs .pop ('norm' , None )
4063+ cmap = kwargs .pop ('cmap' , None )
4064+ vmin = kwargs .pop ('vmin' , None )
4065+ vmax = kwargs .pop ('vmax' , None )
4066+ color = kwargs .pop ('color' , None )
4067+ shading = kwargs .pop ('shading' , 'faceted' )
40804068
40814069 if len (kwargs ):
40824070 raise TypeError , "quiver() got an unexpected keyword argument '%s'" % kwargs .keys ()[0 ]
@@ -4151,8 +4139,6 @@ def fill(self, *args, **kwargs):
41514139 kwargs control the Polygon properties:
41524140 %(Polygon)s
41534141 """
4154- kwargs = kwargs .copy ()
4155-
41564142 if not self ._hold : self .cla ()
41574143
41584144 patches = []
@@ -4974,7 +4960,7 @@ def spy(self, Z, precision=None, marker=None, markersize=None,
49744960 self .set_aspect (aspect )
49754961 ret = lines
49764962 self .title .set_y (1.05 )
4977- self .xaxis .tick_top ( )
4963+ self .xaxis .set_label_position ( 'top' )
49784964 self .xaxis .set_major_locator (MaxNLocator (integer = True ))
49794965 self .yaxis .set_major_locator (MaxNLocator (integer = True ))
49804966 return ret
@@ -5010,7 +4996,7 @@ def matshow(self, Z, **kwargs):
50104996 kw .update (kwargs )
50114997 im = self .imshow (Z , ** kw )
50124998 self .title .set_y (1.05 )
5013- self .xaxis .tick_top ( )
4999+ self .xaxis .set_label_position ( 'top' )
50145000 self .xaxis .set_major_locator (MaxNLocator (integer = True ))
50155001 self .yaxis .set_major_locator (MaxNLocator (integer = True ))
50165002 return im
0 commit comments