10000 Fix histogram bin edges when plotting histogram · livlutz/matplotlib@3ee4a67 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ee4a67

Browse files
authored
Fix histogram bin edges when plotting histogram
1 parent 0800664 commit 3ee4a67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

galleries/examples/color/colorbar_histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
cax = ax.inset_axes([1.18, 0.02, 0.25, 0.95]) # left, bottom, width, height
3636

3737
# plot histogram
38-
counts, bin_edges = np.histogram(Z, bins=bins)
38+
counts, _ = np.histogram(Z, bins=bin_edges)
3939
midpoints = (bin_edges[:-1] + bin_edges[1:]) / 2
4040
distance = midpoints[1] - midpoints[0]
4141
cax.barh(midpoints, counts, height=0.8 * distance, color=cmap(norm(midpoints)))

0 commit comments

Comments
 (0)
0