@@ -109,19 +109,22 @@ def _process_plot_format(fmt):
109109 for c in chars :
110110 if mpl_lines .lineStyles .has_key (c ):
111111 if linestyle is not None :
112- raise ValueError , 'Illegal format string "%s"; two linestyle symbols' % fmt
112+ raise ValueError (
113+ 'Illegal format string "%s"; two linestyle symbols' % fmt )
113114 linestyle = c
114115 elif mpl_lines .lineMarkers .has_key (c ):
115116 if marker is not None :
116- raise ValueError , 'Illegal format string "%s"; two marker symbols' % fmt
117+ raise ValueError (
118+ 'Illegal format string "%s"; two marker symbols' % fmt )
117119 marker = c
118120 elif mpl_colors .colorConverter .colors .has_key (c ):
119121 if color is not None :
120- raise ValueError , 'Illegal format string "%s"; two color symbols' % fmt
122+ raise ValueError (
123+ 'Illegal format string "%s"; two color symbols' % fmt )
121124 color = c
122125 else :
123- err = 'Unrecognized character %c in format string' % c
124- raise ValueError , err
126+ raise ValueError (
127+ 'Unrecognized character %c in format string' % c )
125128
126129 if linestyle is None and marker is None :
127130 linestyle = mpl_rcParams ['lines.linestyle' ]
@@ -904,7 +907,7 @@ def apply_aspect(self, data_ratio = None):
904907 l ,b ,w ,h = self .get_position (original = True )
905908 box_aspect = fig_aspect * (h / w )
906909 data_ratio = box_aspect / A
907- #print 'box_aspect, data_ratio, ysize/xsize', box_aspect, data_ratio, ysize/xsize
910+
908911 y_expander = (data_ratio * xsize / ysize - 1.0 )
909912 #print 'y_expander', y_expander
910913 # If y_expander > 0, the dy/dx viewLim ratio needs to increase
@@ -965,7 +968,8 @@ def axis(self, *v, **kwargs):
965968 Convenience method for manipulating the x and y view limits
966969 and the aspect ratio of the plot.
967970
968- kwargs are passed on to set_xlim and set_ylim -- see their docstrings for details
971+ kwargs are passed on to set_xlim and set_ylim -- see their
972+ docstrings for details
969973 '''
970974 if len (v )== 1 and mpl_cbook .is_string_like (v [0 ]):
971975 s = v [0 ].lower ()
@@ -1192,24 +1196,20 @@ def _process_unit_info(self, xdata=None, ydata=None, kwargs=None):
11921196
11931197 if xdata is not None :
11941198 self .xaxis .update_units (xdata )
1195- #print '_process updated xdata: units=%s, converter=%s'%(self.xaxis.units, self.xaxis.converter)
1196-
1199+
11971200 if ydata is not None :
11981201 self .yaxis .update_units (ydata )
1199- #print '_process updated ydata: units=%s, converter=%s'%(self.yaxis.units, self.yaxis.converter)
1200-
1202+
12011203 # process kwargs 2nd since these will override default units
12021204 if kwargs is not None :
12031205 xunits = kwargs .pop ( 'xunits' , self .xaxis .units )
12041206 if xunits != self .xaxis .units :
12051207 self .xaxis .set_units (xunits )
1206- #print '_process updated xunits kws: units=%s, converter=%s'%(self.xaxis.units, self.xaxis.converter)
1207-
1208+
12081209 yunits = kwargs .pop ('yunits' , self .yaxis .units )
12091210 if yunits != self .yaxis .units :
12101211 self .yaxis .set_units (yunits )
1211- #print '_process updated yunits kws: units=%s, converter=%s'%(self.yaxis.units, self.yaxis.converter)
1212-
1212+
12131213 def in_axes (self , xwin , ywin ):
12141214 'return True is the point xwin, ywin (display coords) are in the Axes'
12151215 return self .bbox .contains (xwin , ywin )
@@ -1273,12 +1273,8 @@ def draw(self, renderer=None, inframe=False):
12731273 if not self .get_visible (): return
12741274 renderer .open_group ('axes' )
12751275 self .apply_aspect ()
1276- try : self .transData .freeze () # eval the lazy objects
1277- except ValueError :
1278- print >> sys .stderr , 'data freeze value error' , self .get_position (), self .dataLim .get_bounds (), self .viewLim .get_bounds ()
1279- raise
1280-
1281- self .transAxes .freeze () # eval the lazy objects
1276+ self .transData .freeze () # eval the lazy objects
1277+ self .transAxes .freeze ()
12821278 if self .axison and self ._frameon : self .axesPatch .draw (renderer )
12831279 artists = []
12841280
@@ -1525,20 +1521,18 @@ def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
15251521 xmin ,xmax = xmin
15261522
15271523
1528- #print 'setxlim before1: units=%s, converter=%s, xmin=%s, xmax=%s'%(self.xaxis.units, self.xaxis.converter, xmin, xmax)
15291524 self ._process_unit_info (xdata = (xmin , xmax ))
1530- #print 'setxlim before2: units=%s, converter=%s, xmin=%s, xmax=%s'%(self.xaxis.units, self.xaxis.converter, xmin, xmax)
15311525 if xmin is not None :
15321526 xmin = self .convert_xunits (xmin )
15331527 if xmax is not None :
15341528 xmax = self .convert_yunits (xmax )
1535- #print 'setxlim after: units=%s, converter=%s, xmin=%s, xmax=%s'%(self.xaxis.units, self.xaxis.converter, xmin, xmax)
15361529
15371530 old_xmin ,old_xmax = self .get_xlim ()
15381531 if xmin is None : xmin = old_xmin
15391532 if xmax is None : xmax = old_xmax
15401533
1541- if self .transData .get_funcx ().get_type ()== mpl_transforms .LOG10 and min (xmin , xmax )<= 0 :
1534+ if (self .transData .get_funcx ().get_type ()== mpl_transforms .LOG10
1535+ and min (xmin , xmax )<= 0 ):
15421536 raise ValueError ('Cannot set nonpositive limits with log transform' )
15431537
15441538 xmin , xmax = mpl_transforms .nonsingular (xmin , xmax , increasing = False )
@@ -1658,7 +1652,8 @@ def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs):
16581652 if ymin is None : ymin = old_ymin
16591653 if ymax is None : ymax = old_ymax
16601654
1661- if self .transData .get_funcy ().get_type ()== mpl_transforms .LOG10 and min (ymin , ymax )<= 0 :
1655+ if (self .transData .get_funcy ().get_type ()== mpl_transforms .LOG10
1656+ and min (ymin , ymax )<= 0 ):
16621657 raise ValueError ('Cannot set nonpositive limits with log transform' )
16631658
16641659 ymin , ymax = mpl_transforms .nonsingular (ymin , ymax , increasing = False )
@@ -1946,7 +1941,8 @@ def pick(self,*args):
19461941 the artist and the artist has picker set
19471942 """
19481943 if len (args )> 1 :
1949- raise DeprecationWarning ('New pick API implemented -- see API_CHANGES in the src distribution' )
1944+ raise DeprecationWarning (
1945+ 'New pick API implemented -- see API_CHANGES in the src distribution' )
19501946 mpl_artist .Artist .pick (self ,args [0 ])
19511947
19521948 def __pick (self , x , y , trans = None , among = None ):
@@ -2282,7 +2278,7 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
22822278 %(Polygon)s
22832279 """
22842280 # convert y axis units
2285- trans = mpl_transforms .blend_xy_sep_transform ( self .transAxes , self .transData )
2281+ trans = mpl_transforms .blend_xy_sep_transform ( self .transAxes , self .transData )
22862282 verts = (xmin , ymin ), (xmin , ymax ), (xmax , ymax ), (xmax , ymin )
22872283 p = mpl_patches .Polygon (verts , ** kwargs )
22882284 p .set_transform (trans )
@@ -2322,7 +2318,7 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
23222318 %(Polygon)s
23232319 """
23242320 # convert x axis units
2325- trans = mpl_transforms .blend_xy_sep_transform ( self .transData , self .transAxes )
2321+ trans = mpl_transforms .blend_xy_sep_transform (self .transData , self .transAxes )
23262322 verts = [(xmin , ymin ), (xmin , ymax ), (xmax , ymax ), (xmax , ymin )]
23272323 p = mpl_patches .Polygon (verts , ** kwargs )
23282324 p .set_transform (trans )
@@ -2342,7 +2338,8 @@ def hlines(self, y, xmin, xmax, colors='k', linestyle='solid',
23422338 determined by xmin and xmax
23432339
23442340
2345- colors is a line collections color args, either a single color or a len(x) list of colors
2341+ colors is a line collections color args, either a single color
2342+ or a len(x) list of colors
23462343
23472344 linestyle is one of solid|dashed|dashdot|dotted
23482345
@@ -2913,8 +2910,10 @@ def legend(self, *args, **kwargs):
29132910 def get_handles ():
29142911 handles = self .lines [:]
29152912 handles .extend (self .patches )
2916- handles .extend ([c for c in self .collections if isinstance (c , mpl_collections .LineCollection )])
2917- handles .extend ([c for c in self .collections if isinstance (c , mpl_collections .RegularPolyCollection )])
2913+ handles .extend ([c for c in self .collections
2914+ if isinstance (c , mpl_collections .LineCollection )])
2915+ handles .extend ([c for c in self .collections
2916+ if isinstance (c , mpl_collections .RegularPolyCollection )])
29182917 return handles
29192918
29202919 if len (args )== 0 :
@@ -3553,8 +3552,10 @@ def errorbar(self, x, y, yerr=None, xerr=None,
35533552
35543553 barcols .append ( self .hlines (y , left , right , label = '_nolegend_' ))
35553554 if capsize > 0 :
3556- caplines .extend ( self .plot (left , y , 'k|' , ms = 2 * capsize , label = '_nolegend_' ) )
3557- caplines .extend ( self .plot (right , y , 'k|' , ms = 2 * capsize , label = '_nolegend_' ) )
3555+ caplines .extend (
3556+ self .plot (left , y , 'k|' , ms = 2 * capsize , label = '_nolegend_' ) )
3557+ caplines .extend (
3558+ self .plot (right , y , 'k|' , ms = 2 * capsize , label = '_nolegend_' ) )
35583559
35593560 if yerr is not None :
35603561 if len (yerr .shape ) == 1 :
@@ -3736,8 +3737,11 @@ def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
37363737 if notch_min < q1 :
37373738 notch_min = q1
37383739 # make our notched box vectors
3739- box_x = [box_x_min , box_x_max , box_x_max , cap_x_max , box_x_max , box_x_max , box_x_min , box_x_min , cap_x_min , box_x_min , box_x_min ]
3740- box_y = [q1 , q1 , notch_min , med , notch_max , q3 , q3 , notch_max , med , notch_min , q1 ]
3740+ box_x = [box_x_min , box_x_max , box_x_max , cap_x_max , box_x_max ,
3741+ box_x_max , box_x_min , box_x_min , cap_x_min , box_x_min ,
3742+ box_x_min ]
3743+ box_y = [q1 , q1 , notch_min , med , notch_max , q3 , q3 , notch_max ,
3744+ med , notch_min , q1 ]
37413745 # make our median line vectors
37423746 med_x = [cap_x_min , cap_x_max ]
37433747 med_y = [med , med ]
@@ -3935,7 +3939,8 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
39353939 sym = True
39363940
39373941 if marker [1 ]== 1 :
3938- # starlike symbol, everthing else is interpreted as solid symbol
3942+ # starlike symbol, everthing else is interpreted
3943+ # as solid symbol
39393944 starlike = True
39403945
39413946 else :
@@ -4100,22 +4105,24 @@ def quiver_classic(self, U, V, *args, **kwargs ):
41004105
41014106 Make a vector plot (U, V) with arrows on a grid (X, Y)
41024107
4103- If X and Y are not specified, U and V must be 2D arrays. Equally spaced
4104- X and Y grids are then generated using the meshgrid command.
4108+ If X and Y are not specified, U and V must be 2D arrays.
4109+ Equally spaced X and Y grids are then generated using the
4110+ meshgrid command.
41054111
4106- color can be a color value or an array of colors, so that the arrows can be
4107- colored according to another dataset. If cmap is specified and color is 'length',
4108- the colormap is used to give a color according to the vector's length.
4112+ color can be a color value or an array of colors, so that the
4113+ arrows can be colored according to another dataset. If cmap
4114+ is specified and color is 'length', the colormap is used to
4115+ give a color according to the vector's length.
41094116
4110- If color is a scalar field, the colormap is used to map the scalar to a color
4111- If a colormap is specified and color is an array of color triplets, then the
4112- colormap is ignored
4117+ If color is a scalar field, the colormap is used to map the
4118+ scalar to a color If a colormap is specified and color is an
4119+ array of color triplets, then the colormap is ignored
41134120
41144121 width is a scalar that controls the width of the arrows
41154122
4116- if S is specified it is used to scale the vectors. Use S=0 to disable automatic
4117- scaling.
4118- If S!=0, vectors are scaled to fit within the grid and then are multiplied by S.
4123+ if S is specified it is used to scale the vectors. Use S=0 to
4124+ disable automatic scaling. If S!=0, vectors are scaled to fit
4125+ within the grid and then are multiplied by S.
41194126
41204127
41214128 """
@@ -4180,7 +4187,8 @@ def quiver_classic(self, U, V, *args, **kwargs ):
41804187 shading = kwargs .pop ('shading' , 'faceted' )
41814188
41824189 if len (kwargs ):
4183- raise TypeError , "quiver() got an unexpected keyword argument '%s'" % kwargs .keys ()[0 ]
4190+ raise TypeError (
4191+ "quiver() got an unexpected keyword argument '%s'" % kwargs .keys ()[0 ])
41844192
41854193 C = None
41864194 if color == 'length' or color is True :
@@ -4196,9 +4204,6 @@ def quiver_classic(self, U, V, *args, **kwargs ):
41964204 C = clr
41974205
41984206 I = U .shape [0 ]
4199- #arrows = []
4200- #for i in xrange(I):
4201- # arrows.append( mpl_patches.FancyArrow(X[i],Y[i],U[i],V[i],0.1*S ).get_verts() )
42024207 arrows = [mpl_patches .FancyArrow (X [i ],Y [i ],U [i ],V [i ],0.1 * S ).get_verts ()
42034208 for i in xrange (I )]
42044209
@@ -4634,7 +4639,9 @@ def pcolormesh(self, *args, **kwargs):
46344639 See pcolor for an explantion of the grid orientation and the
46354640 expansion of 1-D X and/or Y to 2-D arrays.
46364641
4637- kwargs can be used to control the collections.QuadMesh polygon collection properties:
4642+ kwargs can be used to control the collections.QuadMesh polygon
4643+ collection properties:
4644+
46384645 %(QuadMesh)s
46394646 """
46404647 if not self ._hold : self .cla ()
@@ -4677,7 +4684,8 @@ def pcolormesh(self, *args, **kwargs):
46774684 else :
46784685 showedges = 0
46794686
4680- collection = mpl_collections .QuadMesh (Nx - 1 , Ny - 1 , coords , showedges , ** kwargs )
4687+ collection = mpl_collections .QuadMesh (
4688+ Nx - 1 , Ny - 1 , coords , showedges , ** kwargs )
46814689 collection .set_alpha (alpha )
46824690 collection .set_array (C )
46834691 if norm is not None : assert (isinstance (norm , mpl_colors .Normalize ))
@@ -5596,8 +5604,9 @@ def set_thetagrids(self, angles, labels=None, fmt='%d', frac = 1.1,
55965604 r = mpl_mlab .linspace (0. , rmax , self .RESOLUTION )
55975605 for a in angles :
55985606 theta = npy .ones (self .RESOLUTION )* a / 180. * math .pi
5599- line = mpl_lines .Line2D (theta , r , linestyle = ls , color = color , linewidth = lw ,
5600- figure = self .figure )
5607+ line = mpl_lines .Line2D (
5608+ theta , r , linestyle = ls , color = color , linewidth = lw ,
5609+ figure = self .figure )
56015610 line .set_transform (self .transData )
56025611 self .thetagridlines .append (line )
56035612
@@ -5784,7 +5793,9 @@ def __str__(self):
57845793 return "PolarSubplot(%gx%g)" % (self .figW ,self .figH )
57855794 def __init__ (self , fig , * args , ** kwargs ):
57865795 SubplotBase .__init__ (self , fig , * args )
5787- PolarAxes .__init__ (self , fig , [self .figLeft , self .figBottom , self .figW , self .figH ], ** kwargs )
5796+ PolarAxes .__init__ (
5797+ self , fig ,
5798+ [self .figLeft , self .figBottom , self .figW , self .figH ], ** kwargs )
57885799
57895800
57905801
0 commit comments