13
13
import matplotlib .artist as martist
14
14
from matplotlib .artist import allow_rasterization
15
15
import matplotlib .axis as maxis
16
- import matplotlib .cbook as cbook
16
+ import matplotlib ._cbook as _cbook
17
17
import matplotlib .collections as mcoll
18
18
import matplotlib .colors as mcolors
19
19
import matplotlib .contour as mcontour
40
40
from matplotlib import MatplotlibDeprecationWarning as mplDeprecation
41
41
from matplotlib .container import BarContainer , ErrorbarContainer , StemContainer
42
42
43
- iterable = cbook .iterable
44
- is_string_like = cbook .is_string_like
45
- is_sequence_of_strings = cbook .is_sequence_of_strings
43
+ iterable = _cbook .iterable
44
+ is_string_like = _cbook .is_string_like
45
+ is_sequence_of_strings = _cbook .is_sequence_of_strings
46
46
47
47
48
48
def _string_to_bool (s ):
@@ -338,15 +338,15 @@ class Axes(martist.Artist):
338
338
coordinate system.
339
339
340
340
The :class:`Axes` instance supports callbacks through a callbacks
341
- attribute which is a :class:`~matplotlib.cbook .CallbackRegistry`
341
+ attribute which is a :class:`~matplotlib._cbook .CallbackRegistry`
342
342
instance. The events you can connect to are 'xlim_changed' and
343
343
'ylim_changed' and the callback will be called with func(*ax*)
344
344
where *ax* is the :class:`Axes` instance.
345
345
"""
346
346
name = "rectilinear"
347
347
348
- _shared_x_axes = cbook .Grouper ()
349
- _shared_y_axes = cbook .Grouper ()
348
+ _shared_x_axes = _cbook .Grouper ()
349
+ _shared_y_axes = _cbook .Grouper ()
350
350
351
351
def __str__ (self ):
352
352
return "Axes(%g,%g;%gx%g)" % tuple (self ._position .bounds )
@@ -849,7 +849,7 @@ def cla(self):
849
849
spine .cla ()
850
850
851
851
self .ignore_existing_data_limits = True
852
- self .callbacks = cbook .CallbackRegistry ()
852
+ self .callbacks = _cbook .CallbackRegistry ()
853
853
854
854
if self ._sharex is not None :
855
855
# major and minor are class instances with
@@ -1381,24 +1381,24 @@ def get_legend(self):
1381
1381
1382
1382
def get_images (self ):
1383
1383
"""return a list of Axes images contained by the Axes"""
1384
- return cbook .silent_list ('AxesImage' , self .images )
1384
+ return _cbook .silent_list ('AxesImage' , self .images )
1385
1385
1386
1386
def get_lines (self ):
1387
1387
"""Return a list of lines contained by the Axes"""
1388
- return cbook .silent_list ('Line2D' , self .lines )
1388
+ return _cbook .silent_list ('Line2D' , self .lines )
1389
1389
1390
1390
def get_xaxis (self ):
1391
1391
"""Return the XAxis instance"""
1392
1392
return self .xaxis
1393
1393
1394
1394
def get_xgridlines (self ):
1395
1395
"""Get the x grid lines as a list of Line2D instances"""
1396
- return cbook .silent_list ('Line2D xgridline' ,
1396
+ return _cbook .silent_list ('Line2D xgridline' ,
1397
1397
self .xaxis .get_gridlines ())
1398
1398
1399
1399
def get_xticklines (self ):
1400
1400
"""Get the xtick lines as a list of Line2D instances"""
1401
- return cbook .silent_list ('Text xtickline' ,
1401
+ return _cbook .silent_list ('Text xtickline' ,
1402
1402
self .xaxis .get_ticklines ())
1403
1403
1404
1404
def get_yaxis (self ):
@@ -1407,12 +1407,12 @@ def get_yaxis(self):
1407
1407
1408
1408
def get_ygridlines (self ):
1409
1409
"""Get the y grid lines as a list of Line2D instances"""
1410
- return cbook .silent_list ('Line2D ygridline' ,
1410
+ return _cbook .silent_list ('Line2D ygridline' ,
1411
1411
self .yaxis .get_gridlines ())
1412
1412
1413
1413
def get_yticklines (self ):
1414
1414
"""Get the ytick lines as a list of Line2D instances"""
1415
- return cbook .silent_list ('Line2D ytickline' ,
1415
+ return _cbook .silent_list ('Line2D ytickline' ,
1416
1416
self .yaxis .get_ticklines ())
1417
1417
1418
1418
#### Adding and tracking artists
@@ -2593,23 +2593,23 @@ def get_xmajorticklabels(self):
2593
2593
Get the xtick labels as a list of :class:`~matplotlib.text.Text`
2594
2594
instances.
2595
2595
"""
2596
- return cbook .silent_list ('Text xticklabel' ,
2596
+ return _cbook .silent_list ('Text xticklabel' ,
2597
2597
self .xaxis .get_majorticklabels ())
2598
2598
2599
2599
def get_xminorticklabels (self ):
2600
2600
"""
2601
2601
Get the x minor tick labels as a list of
2602
2602
:class:`matplotlib.text.Text` instances.
2603
2603
"""
2604
- return cbook .silent_list ('Text xticklabel' ,
2604
+ return _cbook .silent_list ('Text xticklabel' ,
2605
2605
self .xaxis .get_minorticklabels ())
2606
2606
2607
2607
def get_xticklabels (self , minor = False ):
2608
2608
"""
2609
2609
Get the x tick labels as a list of :class:`~matplotlib.text.Text`
2610
2610
instances.
2611
2611
"""
2612
- return cbook .silent_list ('Text xticklabel' ,
2612
+ return _cbook .silent_list ('Text xticklabel' ,
2613
2613
self .xaxis .get_ticklabels (minor = minor ))
2614
2614
2615
2615
@docstring .dedent_interpd
@@ -2823,23 +2823,23 @@ def get_ymajorticklabels(self):
2823
2823
Get the major y tick labels as a list of
2824
2824
:class:`~matplotlib.text.Text` instances.
2825
2825
"""
2826
- return cbook .silent_list ('Text yticklabel' ,
2826
+ return _cbook .silent_list ('Text yticklabel' ,
2827
2827
self .yaxis .get_majorticklabels ())
2828
2828
2829
2829
def get_yminorticklabels (self ):
2830
2830
"""
2831
2831
Get the minor y tick labels as a list of
2832
2832
:class:`~matplotlib.text.Text` instances.
2833
2833
"""
2834
- return cbook .silent_list ('Text yticklabel' ,
2834
+ return _cbook .silent_list ('Text yticklabel' ,
2835
2835
self .yaxis .get_minorticklabels ())
2836
2836
2837
2837
def get_yticklabels (self , minor = False ):
2838
2838
"""
2839
2839
Get the y tick labels as a list of :class:`~matplotlib.text.Text`
2840
2840
instances
2841
2841
"""
2842
- return cbook .silent_list ('Text yticklabel' ,
2842
+ return _cbook .silent_list ('Text yticklabel' ,
2843
2843
self .yaxis .get_ticklabels (minor = minor ))
2844
2844
2845
2845
@docstring .dedent_interpd
@@ -2979,7 +2979,7 @@ def start_pan(self, x, y, button):
2979
2979
Intended to be overridden by new projection types.
2980
2980
2981
2981
"""
2982
- self ._pan_start = cbook .Bunch (
2982
+ self ._pan_start = _cbook .Bunch (
2983
2983
lim = self .viewLim .frozen (),
2984
2984
trans = self .transData .frozen (),
2985
2985
trans_inverse = self .transData .inverted ().frozen (),
@@ -4585,7 +4585,7 @@ def legend(self, *args, **kwargs):
4585
4585
raise TypeError ('Invalid arguments to legend' )
4586
4586
4587
4587
# Why do we need to call "flatten" here? -JJL
4588
- # handles = cbook .flatten(handles)
4588
+ # handles = _cbook .flatten(handles)
4589
4589
4590
4590
self .legend_ = mlegend .Legend (self , handles , labels , ** kwargs )
4591
4591
return self .legend_
@@ -5226,7 +5226,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
5226
5226
autotexts = []
5227
5227
5228
5228
i = 0
5229
- for frac , label , expl in cbook .safezip (x , labels , explode ):
5229
+ for frac , label , expl in _cbook .safezip (x , labels , explode ):
5230
5230
x , y = center
5231
5231
theta2 = theta1 + frac
5232
5232
thetam = 2 * math .pi * 0.5 * (theta1 + theta2 )
@@ -5508,15 +5508,15 @@ def xywhere(xs, ys, mask):
5508
5508
iterable (xerr [0 ]) and iterable (xerr [1 ])):
5509
5509
# using list comps rather than arrays to preserve units
5510
5510
left = [thisx - thiserr for (thisx , thiserr )
5511
- in cbook .safezip (x , xerr [0 ])]
5511
+ in _cbook .safezip (x , xerr [0 ])]
5512
5512
right = [thisx + thiserr for (thisx , thiserr )
5513
- in cbook .safezip (x , xerr [1 ])]
5513
+ in _cbook .safezip (x , xerr [1 ])]
5514
5514
else :
5515
5515
# using list comps rather than arrays to preserve units
5516
5516
left = [thisx - thiserr for (thisx , thiserr )
5517
- in cbook .safezip (x , xerr )]
5517
+ in _cbook .safezip (x , xerr )]
5518
5518
right = [thisx + thiserr for (thisx , thiserr )
5519
- in cbook .safezip (x , xerr )]
5519
+ in _cbook .safezip (x , xerr )]
5520
5520
5521
5521
yo , _ = xywhere (y , right , everymask )
5522
5522
lo , ro = xywhere (left , right , everymask )
@@ -5556,15 +5556,15 @@ def xywhere(xs, ys, mask):
5556
5556
iterable (yerr [0 ]) and iterable (yerr [1 ])):
5557
5557
# using list comps rather than arrays to preserve units
5558
5558
lower = [thisy - thiserr for (thisy , thiserr )
5559
- in cbook .safezip (y , yerr [0 ])]
5559
+ in _cbook .safezip (y , yerr [0 ])]
5560
5560
upper = [thisy + thiserr for (thisy , thiserr )
5561
- in cbook .safezip (y , yerr [1 ])]
5561
+ in _cbook .safezip (y , yerr [1 ])]
5562
5562
else :
5563
5563
# using list comps rather than arrays to preserve units
5564
5564
lower = [thisy - thiserr for (thisy , thiserr )
5565
- in cbook .safezip (y , yerr )]
5565
+ in _cbook .safezip (y , yerr )]
5566
5566
upper = [thisy + thiserr for (thisy , thiserr )
5567
- in cbook .safezip (y , yerr )]
5567
+ in _cbook .safezip (y , yerr )]
5568
5568
5569
5569
xo , _ = xywhere (x , lower , everymask )
5570
5570
lo , uo = xywhere (lower , upper , everymask )
@@ -6084,7 +6084,7 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
6084
6084
if c .size == x .size :
6085
6085
c = np .ma .ravel (c )
6086
6086
6087
- x , y , s , c = cbook .delete_masked_points (x , y , s , c )
6087
+ x , y , s , c = _cbook .delete_masked_points (x , y , s , c )
6088
6088
6089
6089
scales = s # Renamed for readability below.
6090
6090
@@ -6300,7 +6300,7 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
6300
6300
6301
6301
self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
6302
6302
6303
- x , y , C = cbook .delete_masked_points (x , y , C )
6303
+ x , y , C = _cbook .delete_masked_points (x , y , C )
6304
6304
6305
6305
# Set the size of the hexagon grid
6306
6306
if iterable (gridsize ):
@@ -8112,7 +8112,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8112
8112
8113
8113
# Check whether bins or range are given explicitly. In that
8114
8114
# case use those values for autoscaling.
8115
- binsgiven = (cbook .iterable (bins ) or bin_range != None )
8115
+ binsgiven = (_cbook .iterable (bins ) or bin_range != None )
8116
8116
8117
8117
# If bins are not specified either explicitly or via range,
8118
8118
# we need to figure out the range required for all datasets,
@@ -8151,7 +8151,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8151
8151
8152
8152
if cumulative :
8153
8153
slc = slice (None )
8154
- if cbook .is_numlike (cumulative ) and cumulative < 0 :
8154
+ if _cbook .is_numlike (cumulative ) and cumulative < 0 :
8155
8155
slc = slice (None , None , - 1 )
8156
8156
8157
8157
if normed :
@@ -8315,9 +8315,9 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8315
8315
self .autoscale_view ()
8316
8316
8317
8317
if nx == 1 :
8318
- return n [0 ], bins , cbook .silent_list ('Patch' , patches [0 ])
8318
+ return n [0 ], bins , _cbook .silent_list ('Patch' , patches [0 ])
8319
8319
else :
8320
- return n , bins , cbook .silent_list ('Lists of Patches' , patches )
8320
+ return n , bins , _cbook .silent_list ('Lists of Patches' , patches )
8321
8321
8322
8322
@docstring .dedent_interpd
8323
8323
def hist2d (self , x , y , bins = 10 , range = None , normed = False , weights = None ,
0 commit comments