@@ -906,8 +906,10 @@ def cla(self):
906
906
self .containers = []
907
907
908
908
self .grid (self ._gridOn , which = rcParams ['axes.grid.which' ])
909
- props = font_manager .FontProperties (size = rcParams ['axes.titlesize' ],
910
- weight = rcParams ['axes.titleweight' ])
909
+ props = font_manager .FontProperties (
910
+ size = rcParams ['axes.titlesize' ],
911
+ weight = rcParams ['axes.titleweight' ]
912
+ )
911
913
912
914
self .titleOffsetTrans = mtransforms .ScaledTranslation (
913
915
0.0 , 5.0 / 72.0 , self .figure .dpi_scale_trans )
@@ -1179,7 +1181,7 @@ def apply_aspect(self, position=None):
1179
1181
else :
1180
1182
A = aspect
1181
1183
1182
- #Ensure at drawing time that any Axes involved in axis-sharing
1184
+ # Ensure at drawing time that any Axes involved in axis-sharing
1183
1185
# does not have its position changed.
1184
1186
if self in self ._shared_x_axes or self in self ._shared_y_axes :
1185
1187
if self ._adjustable == 'box' :
@@ -1218,10 +1220,8 @@ def apply_aspect(self, position=None):
1218
1220
data_ratio = box_aspect / A
1219
1221
1220
1222
y_expander = (data_ratio * xsize / ysize - 1.0 )
1221
- #print 'y_expander', y_expander
1222
1223
# If y_expander > 0, the dy/dx viewLim ratio needs to increase
1223
1224
if abs (y_expander ) < 0.005 :
1224
- #print 'good enough already'
1225
1225
return
1226
1226
1227
1227
if aspect_scale_mode == "log" :
@@ -1241,30 +1241,25 @@ def apply_aspect(self, position=None):
1241
1241
Xsize = ysize / data_ratio
1242
1242
Xmarg = Xsize - xr
1243
1243
Ymarg = Ysize - yr
1244
- xm = 0 # Setting these targets to, e.g., 0.05*xr does not seem to
1245
- # help.
1244
+ xm = 0 # Setting these targets to, e.g., 0.05*xr does not seem to help
1246
1245
ym = 0
1247
- #print 'xmin, xmax, ymin, ymax', xmin, xmax, ymin, ymax
1248
- #print 'xsize, Xsize, ysize, Ysize', xsize, Xsize, ysize, Ysize
1249
1246
1250
- changex = (self in self ._shared_y_axes
1251
- and self not in self ._shared_x_axes )
1252
- changey = (self in self ._shared_x_axes
1253
- and self not in self ._shared_y_axes )
1247
+ changex = (self in self ._shared_y_axes and
1248
+ self not in self ._shared_x_axes )
1249
+ changey = (self in self ._shared_x_axes and
1250
+ self not in self ._shared_y_axes )
1254
1251
if changex and changey :
1255
1252
warnings .warn ("adjustable='datalim' cannot work with shared "
1256
1253
"x and y axes" )
1257
1254
return
1258
1255
if changex :
1259
1256
adjust_y = False
1260
1257
else :
1261
- #print 'xmarg, ymarg, Xmarg, Ymarg', xmarg, ymarg, Xmarg, Ymarg
1262
1258
if xmarg > xm and ymarg > ym :
1263
- adjy = ((Ymarg > 0 and y_expander < 0 )
1264
- or (Xmarg < 0 and y_expander > 0 ))
1259
+ adjy = ((Ymarg > 0 and y_expander < 0 ) or
1260
+ (Xmarg < 0 and y_expander > 0 ))
1265
1261
else :
1266
1262
adjy = y_expander > 0
1267
- #print 'y_expander, adjy', y_expander, adjy
1268
1263
adjust_y = changey or adjy # (Ymarg > xmarg)
1269
1264
if adjust_y :
1270
1265
yc = 0.5 * (ymin + ymax )
@@ -1274,8 +1269,6 @@ def apply_aspect(self, position=None):
1274
1269
self .set_ybound ((10. ** y0 , 10. ** y1 ))
1275
1270
else :
1276
1271
self .set_ybound ((y0 , y1 ))
1277
- #print 'New y0, y1:', y0, y1
1278
- #print 'New ysize, ysize/xsize', y1-y0, (y1-y0)/xsize
1279
1272
else :
1280
1273
xc = 0.5 * (xmin + xmax )
1281
1274
x0 = xc - Xsize / 2.0
@@ -1284,8 +1277,6 @@ def apply_aspect(self, position=None):
1284
1277
self .set_xbound ((10. ** x0 , 10. ** x1 ))
1285
1278
else :
1286
1279
self .set_xbound ((x0 , x1 ))
1287
- #print 'New x0, x1:', x0, x1
1288
- #print 'New xsize, ysize/xsize', x1-x0, ysize/(x1-x0)
1289
1280
1290
1281
def axis (self , * v , ** kwargs ):
1291
1282
"""
@@ -1402,7 +1393,7 @@ def get_yticklines(self):
1402
1393
return cbook .silent_list ('Line2D ytickline' ,
1403
1394
self .yaxis .get_ticklines ())
1404
1395
1405
- #### Adding and tracking artists
1396
+ # Adding and tracking artists
1406
1397
1407
1398
def _sci (self , im ):
1408
1399
"""
@@ -1588,7 +1579,7 @@ def _update_patch_limits(self, patch):
1588
1579
xys = patch .get_patch_transform ().transform (vertices )
1589
1580
if patch .get_data_transform () != self .transData :
1590
1581
patch_to_data = (patch .get_data_transform () -
1591
- self .transData )
1582
+ self .transData )
1592
1583
xys = patch_to_data .transform (xys )
1593
1584
1594
1585
updatex , updatey = patch .get_transform ().\
@@ -1689,26 +1680,22 @@ def _process_unit_info(self, xdata=None, ydata=None, kwargs=None):
1689
1680
if self .xaxis is None or self .yaxis is None :
1690
1681
return
1691
1682
1692
- #print 'processing', self.get_geometry()
1693
1683
if xdata is not None :
1694
1684
# we only need to update if there is nothing set yet.
1695
1685
if not self .xaxis .have_units ():
1696
1686
self .xaxis .update_units (xdata )
1697
- #print '\tset from xdata', self.xaxis.units
1698
1687
1699
1688
if ydata is not None :
1700
1689
# we only need to update if there is nothing set yet.
1701
1690
if not self .yaxis .have_units ():
1702
1691
self .yaxis .update_units (ydata )
1703
- #print '\tset from ydata', self.yaxis.units
1704
1692
1705
1693
# process kwargs 2nd since these will override default units
1706
1694
if kwargs is not None :
1707
1695
xunits = kwargs .pop ('xunits' , self .xaxis .units )
1708
1696
if self .name == 'polar' :
1709
1697
xunits = kwargs .pop ('thetaunits' , xunits )
1710
1698
if xunits != self .xaxis .units :
1711
- #print '\tkw setting xunits', xunits
1712
1699
self .xaxis .set_units (xunits )
1713
1700
# If the units being set imply a different converter,
1714
1701
# we need to update.
@@ -1719,7 +1706,6 @@ def _process_unit_info(self, xdata=None, ydata=None, kwargs=None):
1719
1706
if self .name == 'polar' :
1720
1707
yunits = kwargs .pop ('runits' , yunits )
1721
1708
if yunits != self .yaxis .units :
1722
- #print '\tkw setting yunits', yunits
1723
1709
self .yaxis .set_units (yunits )
1724
1710
# If the units being set imply a different converter,
1725
1711
# we need to update.
@@ -1937,7 +1923,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
1937
1923
if scalex and self ._autoscaleXon :
1938
1924
xshared = self ._shared_x_axes .get_siblings (self )
1939
1925
dl = [ax .dataLim for ax in xshared ]
1940
- #ignore non-finite data limits if good limits exist
1926
+ # ignore non-finite data limits if good limits exist
1941
1927
finite_dl = [d for d in dl if np .isfinite (d ).all ()]
1942
1928
if len (finite_dl ):
1943
1929
dl = finite_dl
@@ -1963,7 +1949,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
1963
1949
if scaley and self ._autoscaleYon :
1964
1950
yshared = self ._shared_y_axes .get_siblings (self )
1965
1951
dl = [ax .dataLim for ax in yshared ]
1966
- #ignore non-finite data limits if good limits exist
1952
+ # ignore non-finite data limits if good limits exist
1967
1953
finite_dl = [d for d in dl if np .isfinite (d ).all ()]
1968
1954
if len (finite_dl ):
1969
1955
dl = finite_dl
@@ -1984,7 +1970,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
1984
1970
y0 , y1 = ylocator .view_limits (y0 , y1 )
1985
1971
self .set_ybound (y0 , y1 )
1986
1972
1987
- #### Drawing
1973
+ # Drawing
1988
1974
1989
1975
@allow_rasterization
1990
1976
def draw (self , renderer = None , inframe = False ):
@@ -2056,7 +2042,7 @@ def draw(self, renderer=None, inframe=False):
2056
2042
# if the minimum zorder is negative, start rasterization
2057
2043
rasterization_zorder = self ._rasterization_zorder
2058
2044
if (rasterization_zorder is not None and
2059
- len (dsu ) > 0 and dsu [0 ][0 ] < rasterization_zorder ):
2045
+ len (dsu ) > 0 and dsu [0 ][0 ] < rasterization_zorder ):
2060
2046
renderer .start_rasterizing ()
2061
2047
dsu_rasterized = [l for l in dsu if l [0 ] < rasterization_zorder ]
2062
2048
dsu = [l for l in dsu if l [0 ] >= rasterization_zorder ]
@@ -2133,7 +2119,7 @@ def redraw_in_frame(self):
2133
2119
def get_renderer_cache (self ):
2134
2120
return self ._cachedRenderer
2135
2121
2136
- #### Axes rectangle characteristics
2122
+ # Axes rectangle characteristics
2137
2123
2138
2124
def get_frame_on (self ):
2139
2125
"""
@@ -2430,7 +2416,7 @@ def set_axis_bgcolor(self, color):
2430
2416
self ._axisbg = color
2431
2417
self .patch .set_facecolor (color )
2432
2418
2433
- ### data limits, ticks, tick labels, and formatting
2419
+ # data limits, ticks, tick labels, and formatting
2434
2420
2435
2421
def invert_xaxis (self ):
2436
2422
"Invert the x-axis."
@@ -2575,7 +2561,7 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
2575
2561
other .set_xlim (self .viewLim .intervalx ,
2576
2562
emit = False , auto = auto )
2577
2563
if (other .figure != self .figure and
2578
- other .figure .canvas is not None ):
2564
+ other .figure .canvas is not None ):
2579
2565
other .figure .canvas .draw_idle ()
2580
2566
2581
2567
return left , right
@@ -2910,8 +2896,8 @@ def get_yticklabels(self, minor=False, which=None):
2910
2896
List of :class:`~matplotlib.text.Text` instances.
2911
2897
"""
2912
2898
return cbook .silent_list ('Text yticklabel' ,
2913
- self .yaxis .get_ticklabels (minor = minor ,
2914
- which = which ))
2899
+ self .yaxis .get_ticklabels (minor = minor ,
2900
+ which = which ))
2915
2901
2916
2902
@docstring .dedent_interpd
2917
2903
def set_yticklabels (self , labels , fontdict = None , minor = False , ** kwargs ):
@@ -3004,7 +2990,7 @@ def minorticks_off(self):
3004
2990
self .xaxis .set_minor_locator (mticker .NullLocator ())
3005
2991
self .yaxis .set_minor_locator (mticker .NullLocator ())
3006
2992
3007
- #### Interactive manipulation
2993
+ # Interactive manipulation
3008
2994
3009
2995
def can_zoom (self ):
3010
2996
"""
0 commit comments