@@ -425,10 +425,10 @@ class Axes(martist.Artist):
425
425
426
426
"""
427
427
name = "rectilinear"
428
-
428
+
429
429
_shared_x_axes = cbook .Grouper ()
430
430
_shared_y_axes = cbook .Grouper ()
431
-
431
+
432
432
def __str__ (self ):
433
433
return "Axes(%g,%g;%gx%g)" % tuple (self ._position .bounds )
434
434
def __init__ (self , fig , rect ,
@@ -496,7 +496,7 @@ def __init__(self, fig, rect,
496
496
497
497
# this call may differ for non-sep axes, eg polar
498
498
self ._init_axis ()
499
-
499
+
500
500
if axisbg is None : axisbg = rcParams ['axes.facecolor' ]
501
501
self ._axisbg = axisbg
502
502
self ._frameon = frameon
@@ -679,20 +679,20 @@ def get_yaxis_text2_transform(self, pad_pixels):
679
679
return (self ._yaxis_transform +
680
680
mtransforms .Affine2D ().translate (pad_pixels , 0 ),
681
681
"center" , "left" )
682
-
682
+
683
683
def _update_transScale (self ):
684
684
self .transScale .set (
685
685
mtransforms .blended_transform_factory (
686
686
self .xaxis .get_transform (), self .yaxis .get_transform ()))
687
-
687
+
688
688
def get_position (self , original = False ):
689
689
'Return the a copy of the axes rectangle as a Bbox'
690
690
if original :
691
691
return self ._originalPosition .frozen ()
692
692
else :
693
693
return self ._position .frozen ()
694
694
695
-
695
+
696
696
def set_position (self , pos , which = 'both' ):
697
697
"""
698
698
Set the axes position with pos = [left, bottom, width, height]
@@ -734,7 +734,7 @@ def get_axes_patch(self):
734
734
Intended to be overridden by new projection types.
735
735
"""
736
736
return mpatches .Rectangle ((0.0 , 0.0 ), 1.0 , 1.0 )
737
-
737
+
738
738
def cla (self ):
739
739
'Clear the current axes'
740
740
@@ -780,7 +780,7 @@ def cla(self):
780
780
self .title .set_clip_box (None )
781
781
782
782
self ._set_artist_props (self .title )
783
-
783
+
784
784
self .axesPatch = self .get_axes_patch ()
785
785
self .axesPatch .set_figure (self .figure )
786
786
self .axesPatch .set_facecolor (self ._axisbg )
@@ -904,7 +904,7 @@ def get_data_ratio(self):
904
904
ymin ,ymax = self .get_ybound ()
905
905
ysize = max (math .fabs (ymax - ymin ), 1e-30 )
906
906
return ysize / xsize
907
-
907
+
908
908
def apply_aspect (self ):
909
909
'''
910
910
Use self._aspect and self._adjustable to modify the
@@ -938,7 +938,7 @@ def apply_aspect(self):
938
938
xsize = max (math .fabs (xmax - xmin ), 1e-30 )
939
939
ymin ,ymax = self .get_ybound ()
940
940
ysize = max (math .fabs (ymax - ymin ), 1e-30 )
941
-
941
+
942
942
l ,b ,w ,h = self .get_position (original = True ).bounds
943
943
box_aspect = fig_aspect * (h / w )
944
944
data_ratio = box_aspect / A
@@ -1125,7 +1125,6 @@ def add_artist(self, a):
1125
1125
a .set_axes (self )
1126
1126
self .artists .append (a )
1127
1127
self ._set_artist_props (a )
1128
- # MGDTODO: We may not want to do this -- the old trunk didn't
1129
1128
a .set_clip_path (self .axesPatch )
1130
1129
a ._remove_method = lambda h : self .artists .remove (h )
1131
1130
@@ -1168,7 +1167,7 @@ def add_patch(self, p):
1168
1167
self ._update_patch_limits (p )
1169
1168
self .patches .append (p )
1170
1169
p ._remove_method = lambda h : self .patches .remove (h )
1171
-
1170
+
1172
1171
def _update_patch_limits (self , p ):
1173
1172
'update the datalimits for patch p'
1174
1173
vertices = p .get_patch_transform ().transform (p .get_path ().vertices )
@@ -1181,7 +1180,6 @@ def add_table(self, tab):
1181
1180
'Add a table instance to the list of axes tables'
1182
1181
self ._set_artist_props (tab )
1183
1182
self .tables .append (tab )
1184
- # MGDTODO: We may not want to do this (the old version in trunk didn't)
1185
1183
tab .set_clip_path (self .axesPatch )
1186
1184
tab ._remove_method = lambda h : self .tables .remove (h )
1187
1185
@@ -1202,7 +1200,8 @@ def update_datalim(self, xys):
1202
1200
# and the data in xydata
1203
1201
if not ma .isMaskedArray (xys ):
1204
1202
xys = npy .asarray (xys )
1205
- self .update_datalim_numerix (xys [:, 0 ], xys [:, 1 ])
1203
+ self .dataLim .update_from_data_xy (xys , self .ignore_existing_data_limits )
1204
+ self .ignore_existing_data_limits = False
1206
1205
1207
1206
def update_datalim_numerix (self , x , y ):
1208
1207
'Update the data lim bbox with seq of xy tups'
@@ -1216,7 +1215,7 @@ def update_datalim_numerix(self, x, y):
1216
1215
def update_datalim_bounds (self , bounds ):
1217
1216
'Update the datalim to include the given Bbox'
1218
1217
self .dataLim .set (Bbox .union ([self .dataLim , bounds ]))
1219
-
1218
+
1220
1219
def _process_unit_info (self , xdata = None , ydata = None , kwargs = None ):
1221
1220
'look for unit kwargs and update the axis instances as necessary'
1222
1221
@@ -1303,7 +1302,7 @@ def draw(self, renderer=None, inframe=False):
1303
1302
1304
1303
if self .axison and self ._frameon :
1305
1304
self .axesPatch .draw (renderer )
1306
-
1305
+
1307
1306
artists = []
1308
1307
1309
1308
if len (self .images )<= 1 or renderer .option_image_nocomposite ():
@@ -1513,7 +1512,7 @@ def set_axis_bgcolor(self, color):
1513
1512
self .axesPatch .set_facecolor (color )
1514
1513
1515
1514
### data limits, ticks, tick labels, and formatting
1516
-
1515
+
1517
1516
def invert_xaxis (self ):
1518
1517
"Invert the x-axis."
1519
1518
left , right = self .get_xlim ()
@@ -1601,7 +1600,7 @@ def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
1601
1600
xmin , xmax = self .xaxis .limit_range_for_scale (xmin , xmax )
1602
1601
1603
1602
self .viewLim .intervalx = (xmin , xmax )
1604
-
1603
+
1605
1604
if emit :
1606
1605
self .callbacks .process ('xlim_changed' , self )
1607
1606
# Call all of the other x-axes that are shared with this one
@@ -1610,7 +1609,7 @@ def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
1610
1609
other .set_xlim (self .viewLim .intervalx , emit = False )
1611
1610
if other .figure != self .figure and other .figure .canvas is not None :
1612
1611
other .figure .canvas .draw_idle ()
1613
-
1612
+
1614
1613
return xmin , xmax
1615
1614
1616
1615
def get_xscale (self ):
@@ -1638,7 +1637,7 @@ def set_xscale(self, value, **kwargs):
1638
1637
""" % {'scale' : ' | ' .join ([repr (x ) for x in mscale .get_scale_names ()])}
1639
1638
self .xaxis .set_scale (value , ** kwargs )
1640
1639
self ._update_transScale ()
1641
-
1640
+
1642
1641
def get_xticks (self , minor = False ):
1643
1642
'Return the x ticks as a list of locations'
1644
1643
return self .xaxis .get_ticklocs (minor = minor )
@@ -1777,7 +1776,7 @@ def get_yscale(self):
1777
1776
'return the xaxis scale string: %s' % (
1778
1777
", " .join (mscale .get_scale_names ()))
1779
1778
return self .yaxis .get_scale ()
1780
-
1779
+
1781
1780
def set_yscale (self , value , ** kwargs ):
1782
1781
"""
1783
1782
SET_YSCALE(value, basey=10, subsy=None)
@@ -1798,7 +1797,7 @@ def set_yscale(self, value, **kwargs):
1798
1797
""" % {'scale' : ' | ' .join ([repr (x ) for x in mscale .get_scale_names ()])}
1799
1798
self .yaxis .set_scale (value , ** kwargs )
1800
1799
self ._update_transScale ()
1801
-
1800
+
1802
1801
def get_yticks (self , minor = False ):
1803
1802
'Return the y ticks as a list of locations'
1804
1803
return self .yaxis .get_ticklocs (minor = minor )
@@ -1903,15 +1902,15 @@ def format_coord(self, x, y):
1903
1902
xs = self .format_xdata (x )
1904
1903
ys = self .format_ydata (y )
1905
1904
return 'x=%s, y=%s' % (xs ,ys )
1906
-
1905
+
1907
1906
#### Interactive manipulation
1908
1907
1909
1908
def can_zoom (self ):
1910
1909
"""
1911
1910
Return True if this axes support the zoom box
1912
1911
"""
1913
1912
return True
1914
-
1913
+
1915
1914
def get_navigate (self ):
1916
1915
"""
1917
1916
Get whether the axes responds to navigation commands
@@ -1949,7 +1948,7 @@ def start_pan(self, x, y, button):
1949
1948
1: LEFT
1950
1949
2: MIDDLE
1951
1950
3: RIGHT
1952
-
1951
+
1953
1952
Intended to be overridden by new projection types.
1954
1953
"""
1955
1954
self ._pan_start = cbook .Bunch (
@@ -1968,7 +1967,7 @@ def end_pan(self):
1968
1967
Intended to be overridden by new projection types.
1969
1968
"""
1970
1969
del self ._pan_start
1971
-
1970
+
1972
1971
def drag_pan (self , button , key , x , y ):
1973
1972
"""
1974
1973
Called when the mouse moves during a pan operation.
@@ -2029,10 +2028,10 @@ def format_deltas(key, dx, dy):
2029
2028
except OverflowError :
2030
2029
warnings .warn ('Overflow while panning' )
2031
2030
return
2032
-
2031
+
2033
2032
self .set_xlim (* result .intervalx )
2034
2033
self .set_ylim (* result .intervaly )
2035
-
2034
+
2036
2035
def get_cursor_props (self ):
2037
2036
"""return the cursor props as a linewidth, color tuple where
2038
2037
linewidth is a float and color is an RGBA tuple"""
@@ -3158,7 +3157,7 @@ def step(self, x, y, *args, **kwargs):
3158
3157
if where not in ('pre' , 'post' , 'mid' ):
3159
3158
raise ValueError ("'where' argument to step must be 'pre', 'post' or 'mid'" )
3160
3159
kwargs ['linestyle' ] = 'steps-' + where
3161
-
3160
+
3162
3161
return self .plot (x , y , * args , ** kwargs )
3163
3162
3164
3163
@@ -3828,7 +3827,7 @@ def xywhere(xs, ys, mask):
3828
3827
# using list comps rather than arrays to preserve units
3829
3828
lower = [thisy - thiserr for (thisy , thiserr ) in cbook .safezip (y ,yerr )]
3830
3829
upper = [thisy + thiserr for (thisy , thiserr ) in cbook .safezip (y ,yerr )]
3831
-
3830
+
3832
3831
barcols .append ( self .vlines (x , lower , upper , ** lines_kw ) )
3833
3832
if capsize > 0 :
3834
3833
@@ -4334,7 +4333,7 @@ def quiverkey(self, *args, **kw):
4334
4333
4335
4334
def quiver (self , * args , ** kw ):
4336
4335
"""
4337
- MGDTODO : Document me
4336
+ TODO : Document me
4338
4337
"""
4339
4338
q = mquiver .Quiver (self , * args , ** kw )
4340
4339
self .add_collection (q , False )
@@ -4516,7 +4515,7 @@ def imshow(self, X,
4516
4515
4517
4516
return im
4518
4517
4519
-
4518
+
4520
4519
def _pcolorargs (self , funcname , * args ):
4521
4520
if len (args )== 1 :
4522
4521
C = args [0 ]
@@ -4790,7 +4789,7 @@ def pcolormesh(self, *args, **kwargs):
4790
4789
shading = kwargs .pop ('shading' , 'flat' )
4791
4790
edgecolors = kwargs .pop ('edgecolors' , 'None' )
4792
4791
antialiased = kwargs .pop ('antialiased' , False )
4793
-
4792
+
4794
4793
X , Y , C = self ._pcolorargs ('pcolormesh' , * args )
4795
4794
Ny , Nx = X .shape
4796
4795
@@ -5519,7 +5518,7 @@ def __init__(self, fig, *args, **kwargs):
5519
5518
5520
5519
# _axes_class is set in the subplot_class_factory
5521
5520
self ._axes_class .__init__ (self , fig , self .figbox , ** kwargs )
5522
-
5521
+
5523
5522
def get_geometry (self ):
5524
5523
'get the subplot geometry, eg 2,2,3'
5525
5524
return self ._rows , self ._cols , self ._num + 1
@@ -5608,24 +5607,24 @@ def label_outer(self):
5608
5607
for label in self .get_yticklabels ():
5609
5608
label .set_visible (firstcol )
5610
5609
5611
- _subplot_classes = {}
5610
+ _subplot_classes = {}
5612
5611
def subplot_class_factory (axes_class = None ):
5613
5612
# This makes a new class that inherits from SubclassBase and the
5614
5613
# given axes_class (which is assumed to be a subclass of Axes).
5615
-
5614
+
5616
5615
# This is perhaps a little bit roundabout to make a new class on
5617
5616
# the fly like this, but it means that a new Subplot class does
5618
5617
# not have to be created for every type of Axes.
5619
5618
if axes_class is None :
5620
5619
axes_class = Axes
5621
-
5620
+
5622
5621
new_class = _subplot_classes .get (axes_class )
5623
5622
if new_class is None :
5624
5623
new_class = new .classobj ("%sSubplot" % (axes_class .__name__ ),
5625
5624
(SubplotBase , axes_class ),
5626
5625
{'_axes_class' : axes_class })
5627
5626
_subplot_classes [axes_class ] = new_class
5628
-
5627
+
5629
5628
return new_class
5630
5629
5631
5630
# This is provided for backward compatibility
0 commit comments