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

Skip to content

Commit 5c7625a

Browse files
committed
Merge pull request #1406 from neggert/stacked_hist_fix
Fix bug when stacking histograms with non-integer weights (v1.2.x branch)
2 parents edfe3c2 + cc42647 commit 5c7625a

6 files changed

Lines changed: 590 additions & 2 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8072,7 +8072,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
80728072
# so that each histogram uses the same bins
80738073
m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)
80748074
if mlast is None:
8075-
mlast = np.zeros(len(bins)-1, np.int)
8075+
mlast = np.zeros(len(bins)-1, m.dtype)
80768076
if normed:
80778077
db = np.diff(bins)
80788078
m = (m.astype(float) / db) / m.sum()

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2654,7 +2654,7 @@ def hist(x, bins=10, range=None, normed=False, weights=None, cumulative=False,
26542654
weights=weights, cumulative=cumulative, bottom=bottom,
26552655
histtype=histtype, align=align, orientation=orientation,
26562656
rwidth=rwidth, log=log, color=color, label=label,
2657-
**kwargs)
2657+
stacked=stacked, **kwargs)
26582658
draw_if_interactive()
26592659
finally:
26602660
ax.hold(washold)
Binary file not shown.
6.4 KB
Loading

0 commit comments

Comments
 (0)