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