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

Skip to content

Commit 0871b4a

Browse files
committed
fix case matplotlib#2)
1 parent 9d6d82a commit 0871b4a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7947,15 +7947,15 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
79477947

79487948
if log:
79497949
#in the case of log scale there are three cases to consider for the y axis limit
7950-
#1) has zero or negative bin. we want positive minimum*0.1 to be the minimum
7950+
#1) has zero or negative bin but other bins may be 0<n<1 due to weighting. we want positive minimum*0.1 to be the minimum
79517951
#2) has zero bin but the rest are greater than 1. this one we want minimum at 0.1
79527952
#3) all zero/negative bin .... no idea how to display this anyway so put minimum at 0.1
79537953
ndata = np.array(n)
79547954
if np.all(ndata<=0):
79557955
warnings.warn('Some of histogram bins has zero or negative count.')
79567956

79577957
if np.any(ndata>0):
7958-
if np.all(ndata>=1):
7958+
if np.all(ndata[ndata!=0]>=1):
79597959
minimum = 0.1 # case 2)
79607960
else:
79617961
minimum = np.min(ndata[ndata>0])*0.1 #case 1)

0 commit comments

Comments
 (0)