Skip to content

Commit 756420e

Browse files
authored
Merge pull request matplotlib#23406 from QuLogic/fix-multihist-center
DOC: Fix calculation of bin centers in multi-histogram
2 parents 54d6992 + 33a39d4 commit 756420e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/statistics/multiple_histograms_side_by_side.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545

4646
# The bin_edges are the same for all of the histograms
4747
bin_edges = np.linspace(hist_range[0], hist_range[1], number_of_bins + 1)
48-
centers = 0.5 * (bin_edges + np.roll(bin_edges, 1))[:-1]
4948
heights = np.diff(bin_edges)
49+
centers = bin_edges[:-1] + heights / 2
5050

5151
# Cycle through and plot each histogram
5252
fig, ax = plt.subplots()

0 commit comments

Comments
 (0)