Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9afa10f

Browse files
committed
FIX: handle the integer case
1 parent 3ee8a40 commit 9afa10f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ def histogram_bin_edges(arr, bins, range=None, weights=None):
4646
# update numpy, or pick a manual number of bins
4747
return np.histogram(arr, bins, range, weights)[1]
4848
else:
49-
# not strictly the behavior of histogram_bin_edges, but
50-
# easier to not bother with the linspace here
51-
return bins
49+
if bins is None:
50+
# hard-code numpy's default
51+
bins = 10
52+
if range is None:
53+
range = np.nanmin(arr), np.manmax(arr)
54+
55+
return np.linspace(*range, bins + 1)
5256

5357

5458
_log = logging.getLogger(__name__)

0 commit comments

Comments
 (0)