@@ -6091,13 +6091,24 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
60916091 "Please only use 'density', since 'normed'"
60926092 "will be deprecated." )
60936093
6094+ # basic input validation
6095+ input_empty = np .size (x ) == 0
6096+ # Massage 'x' for processing.
6097+ if input_empty :
6098+ x = np .array ([[]])
6099+ else :
6100+ x = cbook ._reshape_2D (x , 'x' )
6101+ nx = len (x ) # number of datasets
6102+
60946103 # Process unit information
60956104 # If doing a stacked histogram, the input is a list of datasets, so
60966105 # we need to do the unit conversion individually on eaach dataset
60976106 if stacked :
60986107 self ._process_unit_info (xdata = x [0 ], kwargs = kwargs )
6099- for i , xi in enumerate (x ):
6100- x [i ] = self .convert_xunits (xi )
6108+ newx = []
6109+ for xi in x :
6110+ newx .append (self .convert_xunits (xi ))
6111+ x = newx
61016112 else :
61026113 self ._process_unit_info (xdata = x , kwargs = kwargs )
61036114 x = self .convert_xunits (x )
@@ -6108,15 +6119,6 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
61086119 # Check whether bins or range are given explicitly.
61096120 binsgiven = (cbook .iterable (bins ) or bin_range is not None )
61106121
6111- # basic input validation
6112- input_empty = np .size (x ) == 0
6113-
6114- # Massage 'x' for processing.
6115- if input_empty :
6116- x = np .array ([[]])
6117- else :
6118- x = cbook ._reshape_2D (x , 'x' )
6119- nx = len (x ) # number of datasets
61206122
61216123 # We need to do to 'weights' what was done to 'x'
61226124 if weights is not None :
0 commit comments