@@ -5892,7 +5892,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
5892
5892
Parameters
5893
5893
----------
5894
5894
x : (n,) array or sequence of (n,) arrays
5895
- Input values, this takes either a single array or a sequency of
5895
+ Input values, this takes either a single array or a sequence of
5896
5896
arrays which are not required to be of the same length
5897
5897
5898
5898
bins : integer or sequence or 'auto', optional
@@ -6104,30 +6104,31 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
6104
6104
"Please only use 'density', since 'normed'"
6105
6105
"will be deprecated." )
6106
6106
6107
- # process the unit information
6108
- self ._process_unit_info (xdata = x , kwargs = kwargs )
6109
- x = self .convert_xunits (x )
6110
- if bin_range is not None :
6111
- bin_range = self .convert_xunits (bin_range )
6112
-
6113
- # Check whether bins or range are given explicitly.
6114
- binsgiven = (cbook .iterable (bins ) or bin_range is not None )
6115
-
6116
6107
# basic input validation
6117
6108
input_empty = np .size (x ) == 0
6118
-
6119
6109
# Massage 'x' for processing.
6120
6110
if input_empty :
6121
- x = np .array ([[]])
6111
+ x = [ np .array ([])]
6122
6112
else :
6123
6113
x = cbook ._reshape_2D (x , 'x' )
6124
6114
nx = len (x ) # number of datasets
6125
6115
6116
+ # Process unit information
6117
+ # Unit conversion is done individually on each dataset
6118
+ self ._process_unit_info (xdata = x [0 ], kwargs = kwargs )
6119
+ x = [self .convert_xunits (xi ) for xi in x ]
6120
+
6121
+ if bin_range is not None :
6122
+ bin_range = self .convert_xunits (bin_range )
6123
+
6124
+ # Check whether bins or range are given explicitly.
6125
+ binsgiven = (cbook .iterable (bins ) or bin_range is not None )
6126
+
6126
6127
# We need to do to 'weights' what was done to 'x'
6127
6128
if weights is not None :
6128
6129
w = cbook ._reshape_2D (weights , 'weights' )
6129
6130
else :
6130
- w = [None ]* nx
6131
+ w = [None ] * nx
6131
6132
6132
6133
if len (w ) != nx :
6133
6134
raise ValueError ('weights should have the same shape as x' )
0 commit comments