Skip to content

Issue #26990: Split the histogram image into two for each code block. #27074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions galleries/examples/misc/histogram_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import matplotlib.patches as patches
import matplotlib.path as path

fig, axs = plt.subplots(2)

np.random.seed(19680801) # Fixing random state for reproducibility

# histogram our data with numpy
Expand All @@ -44,8 +42,11 @@
# make a patch out of it, don't add a margin at y=0
patch = patches.PathPatch(barpath)
patch.sticky_edges.y[:] = [0]
axs[0].add_patch(patch)
axs[0].autoscale_view()

fig, ax = plt.subplots()
ax.add_patch(patch)
ax.autoscale_view()
plt.show()

# %%
# Instead of creating a three-dimensional array and using
Expand All @@ -72,9 +73,10 @@
# make a patch out of it, don't add a margin at y=0
patch = patches.PathPatch(barpath)
patch.sticky_edges.y[:] = [0]
axs[1].add_patch(patch)
axs[1].autoscale_view()

fig, ax = plt.subplots()
ax.add_patch(patch)
ax.autoscale_view()
plt.show()

# %%
Expand Down