@@ -838,9 +838,8 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
838
838
"argument; axhline generates its own transform." )
839
839
ymin , ymax = self .get_ybound ()
840
840
841
- # We need to strip away the units for comparison with
842
- # non-unitized bounds
843
- self ._process_unit_info (ydata = y , kwargs = kwargs )
841
+ # Strip away the units for comparison with non-unitized bounds.
842
+ self ._process_unit_info ({"y" : y }, kwargs )
844
843
yy = self .convert_yunits (y )
845
844
scaley = (yy < ymin ) or (yy > ymax )
846
845
@@ -907,9 +906,8 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
907
906
"argument; axvline generates its own transform." )
908
907
xmin , xmax = self .get_xbound ()
909
908
910
- # We need to strip away the units for comparison with
911
- # non-unitized bounds
912
- self ._process_unit_info (xdata = x , kwargs = kwargs )
909
+ # Strip away the units for comparison with non-unitized bounds.
910
+ self ._process_unit_info ({"x" : x }, kwargs )
913
911
xx = self .convert_xunits (x )
914
912
scalex = (xx < xmin ) or (xx > xmax )
915
913
@@ -1050,8 +1048,7 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
1050
1048
self ._check_no_units ([xmin , xmax ], ['xmin' , 'xmax' ])
1051
1049
trans = self .get_yaxis_transform (which = 'grid' )
1052
1050
1053
- # process the unit information
1054
- self ._process_unit_info ([xmin , xmax ], [ymin , ymax ], kwargs = kwargs )
1051
+ self ._process_unit_info ({"x" : [xmin , xmax ], "y" : [ymin , ymax ]}, kwargs )
1055
1052
1056
1053
# first we need to strip away the units
1057
1054
xmin , xmax = self .convert_xunits ([xmin , xmax ])
@@ -1111,8 +1108,7 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
1111
1108
self ._check_no_units ([ymin , ymax ], ['ymin' , 'ymax' ])
1112
1109
trans = self .get_xaxis_transform (which = 'grid' )
1113
1110
1114
- # process the unit information
1115
- self ._process_unit_info ([xmin , xmax ], [ymin , ymax ], kwargs = kwargs )
1111
+ self ._process_unit_info ({"x" : [xmin , xmax ], "y" : [ymin , ymax ]}, kwargs )
1116
1112
1117
1113
# first we need to strip away the units
1118
1114
xmin , xmax = self .convert_xunits ([xmin , xmax ])
@@ -1162,8 +1158,7 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid',
1162
1158
"""
1163
1159
1164
1160
# We do the conversion first since not all unitized data is uniform
1165
- # process the unit information
1166
- self ._process_unit_info ([xmin , xmax ], y , kwargs = kwargs )
1161
+ self ._process_unit_info ({"x" : [xmin , xmax ], "y" : y }, kwargs )
1167
1162
y = self .convert_yunits (y )
1168
1163
xmin = self .convert_xunits (xmin )
1169
1164
xmax = self .convert_xunits (xmax )
@@ -1243,9 +1238,8 @@ def vlines(self, x, ymin, ymax, colors=None, linestyles='solid',
1243
1238
axvline: vertical line across the axes
1244
1239
"""
1245
1240
1246
- self ._process_unit_info (xdata = x , ydata = [ymin , ymax ], kwargs = kwargs )
1247
-
1248
1241
# We do the conversion first since not all unitized data is uniform
1242
+ self ._process_unit_info ({"x" : x , "y" : [ymin , ymax ]}, kwargs )
1249
1243
x = self .convert_xunits (x )
1250
1244
ymin = self .convert_yunits (ymin )
1251
1245
ymax = self .convert_yunits (ymax )
@@ -1386,9 +1380,8 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1386
1380
--------
1387
1381
.. plot:: gallery/lines_bars_and_markers/eventplot_demo.py
1388
1382
"""
1389
- self ._process_unit_info (xdata = positions ,
1390
- ydata = [lineoffsets , linelengths ],
1391
- kwargs = kwargs )
1383
+ self ._process_unit_info (
1384
+ {"x" : positions , "y" : [lineoffsets , linelengths ]}, kwargs )
1392
1385
1393
1386
# We do the conversion first since not all unitized data is uniform
1394
1387
positions = self .convert_xunits (positions )
@@ -2416,11 +2409,11 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2416
2409
x = 0
2417
2410
2418
2411
if orientation == 'vertical' :
2419
- self ._process_unit_info (xdata = x , ydata = height , kwargs = kwargs )
2412
+ self ._process_unit_info ({ "x" : x , "y" : height }, kwargs )
2420
2413
if log :
2421
2414
self .set_yscale ('log' , nonpositive = 'clip' )
2422
2415
elif orientation == 'horizontal' :
2423
- self ._process_unit_info (xdata = width , ydata = y , kwargs = kwargs )
2416
+ self ._process_unit_info ({ "x" : width , "y" : y }, kwargs )
2424
2417
if log :
2425
2418
self .set_xscale ('log' , nonpositive = 'clip' )
2426
2419
@@ -2700,9 +2693,7 @@ def broken_barh(self, xranges, yrange, **kwargs):
2700
2693
ydata = cbook .safe_first_element (yrange )
2701
2694
else :
2702
2695
ydata = None
2703
- self ._process_unit_info (xdata = xdata ,
2704
- ydata = ydata ,
2705
- kwargs = kwargs )
2696
+ self ._process_unit_info ({"x" : xdata , "y" : ydata }, kwargs )
2706
2697
xranges_conv = []
2707
2698
for xr in xranges :
2708
2699
if len (xr ) != 2 :
@@ -2823,11 +2814,11 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
2823
2814
locs , heads , * args = args
2824
2815
2825
2816
if orientation == 'vertical' :
2826
- self ._process_unit_info (xdata = locs , ydata = heads )
2817
+ self ._process_unit_info ({ "x" : locs , "y" : heads } )
2827
2818
locs = self .convert_xunits (locs )
2828
2819
heads = self .convert_yunits (heads )
2829
2820
else :
2830
- self ._process_unit_info (xdata = heads , ydata = locs )
2821
+ self ._process_unit_info ({ "x" : heads , "y" : locs } )
2831
2822
heads = self .convert_xunits (heads )
2832
2823
locs = self .convert_yunits (locs )
2833
2824
@@ -3313,7 +3304,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
3313
3304
if int (offset ) != offset :
3314
3305
raise ValueError ("errorevery's starting index must be an integer" )
3315
3306
3316
- self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
3307
+ self ._process_unit_info ({ "x" : x , "y" : y }, kwargs )
3317
3308
3318
3309
# Make sure all the args are iterable; use lists not arrays to preserve
3319
3310
# units.
@@ -4481,7 +4472,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
4481
4472
"""
4482
4473
# Process **kwargs to handle aliases, conflicts with explicit kwargs:
4483
4474
4484
- self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
4475
+ self ._process_unit_info ({ "x" : x , "y" : y }, kwargs )
4485
4476
x = self .convert_xunits (x )
4486
4477
y = self .convert_yunits (y )
4487
4478
@@ -4712,7 +4703,7 @@ def reduce_C_function(C: array) -> float
4712
4703
%(PolyCollection)s
4713
4704
4714
4705
"""
4715
- self ._process_unit_info (xdata = x , ydata = y , kwargs = kwargs )
4706
+ self ._process_unit_info ({ "x" : x , "y" : y }, kwargs )
4716
4707
4717
4708
x , y , C = cbook .delete_masked_points (x , y , C )
4718
4709
@@ -5061,7 +5052,7 @@ def quiverkey(self, Q, X, Y, U, label, **kw):
5061
5052
def _quiver_units (self , args , kw ):
5062
5053
if len (args ) > 3 :
5063
5054
x , y = args [0 :2 ]
5064
- self ._process_unit_info (xdata = x , ydata = y , kwargs = kw )
5055
+ self ._process_unit_info ({ "x" : x , "y" : y }, kw )
5065
5056
x = self .convert_xunits (x )
5066
5057
y = self .convert_yunits (y )
5067
5058
return (x , y ) + args [2 :]
@@ -5249,10 +5240,8 @@ def _fill_between_x_or_y(
5249
5240
self ._get_patches_for_fill .get_next_color ()
5250
5241
5251
5242
# Handle united data, such as dates
5252
- self ._process_unit_info (
5253
- ** {f"{ ind_dir } data" : ind , f"{ dep_dir } data" : dep1 }, kwargs = kwargs )
5254
- self ._process_unit_info (
5255
- ** {f"{ dep_dir } data" : dep2 })
5243
+ self ._process_unit_info ({ind_dir : ind , dep_dir : dep1 }, kwargs )
5244
+ self ._process_unit_info ({dep_dir : dep2 })
5256
5245
5257
5246
# Convert the arrays so we can work with them
5258
5247
ind = ma .masked_invalid (getattr (self , f"convert_{ ind_dir } units" )(ind ))
@@ -5866,7 +5855,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
5866
5855
Ny , Nx = X .shape
5867
5856
5868
5857
# unit conversion allows e.g. datetime objects as axis values
5869
- self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
5858
+ self ._process_unit_info ({ "x" : X , "y" : Y }, kwargs )
5870
5859
X = self .convert_xunits (X )
5871
5860
Y = self .convert_yunits (Y )
5872
5861
@@ -6143,7 +6132,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
6143
6132
X = X .ravel ()
6144
6133
Y = Y .ravel ()
6145
6134
# unit conversion allows e.g. datetime objects as axis values
6146
- self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
6135
+ self ._process_unit_info ({ "x" : X , "y" : Y }, kwargs )
6147
6136
X = self .convert_xunits (X )
6148
6137
Y = self .convert_yunits (Y )
6149
6138
@@ -6627,7 +6616,8 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
6627
6616
6628
6617
# Process unit information
6629
6618
# Unit conversion is done individually on each dataset
6630
- self ._process_unit_info (xdata = x [0 ], kwargs = kwargs )
6619
+ self ._process_unit_info (
6620
+ {"x" if orientation == "vertical" else "y" : x [0 ]}, kwargs )
6631
6621
x = [self .convert_xunits (xi ) for xi in x ]
6632
6622
6633
6623
if bin_range is not None :
0 commit comments