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

Skip to content

Commit 4eae3e4

Browse files
authored
Merge pull request #27074 from niviPy/fix-doc-26990
Issue #26990: Split the histogram image into two for each code block.
2 parents 7eebf2a + 6b96151 commit 4eae3e4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

galleries/examples/misc/histogram_path.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import matplotlib.patches as patches
2121
import matplotlib.path as path
2222

23-
fig, axs = plt.subplots(2)
24-
2523
np.random.seed(19680801) # Fixing random state for reproducibility
2624

2725
# histogram our data with numpy
@@ -44,8 +42,11 @@
4442
# make a patch out of it, don't add a margin at y=0
4543
patch = patches.PathPatch(barpath)
4644
patch.sticky_edges.y[:] = [0]
47-
axs[0].add_patch(patch)
48-
axs[0].autoscale_view()
45+
46+
fig, ax = plt.subplots()
47+
ax.add_patch(patch)
48+
ax.autoscale_view()
49+
plt.show()
4950

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

77+
fig, ax = plt.subplots()
78+
ax.add_patch(patch)
79+
ax.autoscale_view()
7880
plt.show()
7981

8082
# %%

0 commit comments

Comments
 (0)