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

Skip to content

Commit bda0b30

Browse files
committed
Issue 26990
Fix added for image not getting rendered properly. Solution: Split image into two rows for two blocks of code resp.
1 parent 6061057 commit bda0b30

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

galleries/examples/misc/histogram_path.py

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

23-
fig, axs = plt.subplots(2)
23+
fig, axs = plt.subplots(1)
2424

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

@@ -44,14 +44,16 @@
4444
# make a patch out of it, don't add a margin at y=0
4545
patch = patches.PathPatch(barpath)
4646
patch.sticky_edges.y[:] = [0]
47-
axs[0].add_patch(patch)
48-
axs[0].autoscale_view()
47+
axs.add_patch(patch)
48+
axs.autoscale_view()
49+
plt.show()
4950

5051
# %%
5152
# Instead of creating a three-dimensional array and using
5253
# `~.path.Path.make_compound_path_from_polys`, we could as well create the
5354
# compound path directly using vertices and codes as shown below
5455

56+
fig, axs = plt.subplots(1)
5557
nrects = len(left)
5658
nverts = nrects*(1+3+1)
5759
verts = np.zeros((nverts, 2))
@@ -72,9 +74,8 @@
7274
# make a patch out of it, don't add a margin at y=0
7375
patch = patches.PathPatch(barpath)
7476
patch.sticky_edges.y[:] = [0]
75-
axs[1].add_patch(patch)
76-
axs[1].autoscale_view()
77-
77+
axs.add_patch(patch)
78+
axs.autoscale_view()
7879
plt.show()
7980

8081
# %%

0 commit comments

Comments
 (0)