@@ -3846,8 +3846,8 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
3846
3846
if extent is not None :
3847
3847
xmin , xmax , ymin , ymax = extent
3848
3848
else :
3849
- xmin , xmax = (np .amin (x ), np .amax (x )) if x . any ( ) else (0 , 1 )
3850
- ymin , ymax = (np .amin (y ), np .amax (y )) if y . any ( ) else (0 , 1 )
3849
+ xmin , xmax = (np .amin (x ), np .amax (x )) if len ( x ) else (0 , 1 )
3850
+ ymin , ymax = (np .amin (y ), np .amax (y )) if len ( y ) else (0 , 1 )
3851
3851
3852
3852
# to avoid issues with singular data, expand the min/max pairs
3853
3853
xmin , xmax = mtrans .nonsingular (xmin , xmax , expander = 0.1 )
@@ -5641,9 +5641,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
5641
5641
5642
5642
# We need to do to 'weights' what was done to 'x'
5643
5643
if weights is not None :
5644
- if input_empty :
5645
- w = np .array ([])
5646
- elif isinstance (weights , np .ndarray ) or not iterable (weights [0 ]):
5644
+ if isinstance (weights , np .ndarray ) or not iterable (weights [0 ]):
5647
5645
w = np .array (weights )
5648
5646
if w .ndim == 2 :
5649
5647
w = w .T
@@ -5669,7 +5667,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
5669
5667
# If bins are not specified either explicitly or via range,
5670
5668
# we need to figure out the range required for all datasets,
5671
5669
# and supply that to np.histogram.
5672
- if not binsgiven :
5670
+ if not binsgiven and not input_empty :
5673
5671
xmin = np .inf
5674
5672
xmax = - np .inf
5675
5673
for xi in x :
@@ -5681,7 +5679,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
5681
5679
#hist_kwargs = dict(range=range, normed=bool(normed))
5682
5680
# We will handle the normed kwarg within mpl until we
5683
5681
# get to the point of requiring numpy >= 1.5.
5684
- hist_kwargs = dict (range = bin_range ) if not input_empty else dict ()
5682
+ hist_kwargs = dict (range = bin_range )
5685
5683
5686
5684
n = []
5687
5685
mlast = None
0 commit comments