@@ -6470,18 +6470,23 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
6470
6470
x = cbook ._reshape_2D (x , 'x' )
6471
6471
nx = len (x ) # number of datasets
6472
6472
6473
- # Process unit information
6474
- # Unit conversion is done individually on each dataset
6475
- self ._process_unit_info (
6476
- {"x" if orientation == "vertical" else "y" : x [0 ]}, kwargs ,
6477
- convert = False )
6478
- x = [self .convert_xunits (xi ) for xi in x ]
6473
+ # Process unit information. _process_unit_info sets the unit and
6474
+ # converts the first dataset; then we convert each following dataset
6475
+ # one at a time.
6476
+ if orientation == "vertical" :
6477
+ convert_units = self .convert_yunits
6478
+ x = [* self ._process_unit_info ({"x" : x [0 ]}, kwargs ),
6479
+ * map (convert_units , x [1 :])]
6480
+ else : # horizontal
6481
+ convert_units = self .convert_yunits
6482
+ x = [* self ._process_unit_info ({"y" : x [0 ]}, kwargs ),
6483
+ * map (convert_units , x [1 :])]
6479
6484
6480
6485
if bin_range is not None :
6481
- bin_range = self . convert_xunits (bin_range )
6486
+ bin_range = convert_units (bin_range )
6482
6487
6483
6488
if not cbook .is_scalar_or_string (bins ):
6484
- bins = self . convert_xunits (bins )
6489
+ bins = convert_units (bins )
6485
6490
6486
6491
# We need to do to 'weights' what was done to 'x'
6487
6492
if weights is not None :
0 commit comments