Skip to content

Commit 6b96151

Browse files
committed
Updated with comments suggestions.
1 parent bda0b30 commit 6b96151

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

galleries/examples/misc/histogram_path.py

Lines changed: 8 additions & 7 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(1)
24-
2523
np.random.seed(19680801) # Fixing random state for reproducibility
2624

2725
# histogram our data with numpy
@@ -44,16 +42,17 @@
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.add_patch(patch)
48-
axs.autoscale_view()
45+
46+
fig, ax = plt.subplots()
47+
ax.add_patch(patch)
48+
ax.autoscale_view()
4949
plt.show()
5050

5151
# %%
5252
# Instead of creating a three-dimensional array and using
5353
# `~.path.Path.make_compound_path_from_polys`, we could as well create the
5454
# compound path directly using vertices and codes as shown below
5555

56-
fig, axs = plt.subplots(1)
5756
nrects = len(left)
5857
nverts = nrects*(1+3+1)
5958
verts = np.zeros((nverts, 2))
@@ -74,8 +73,10 @@
7473
# make a patch out of it, don't add a margin at y=0
7574
patch = patches.PathPatch(barpath)
7675
patch.sticky_edges.y[:] = [0]
77-
axs.add_patch(patch)
78-
axs.autoscale_view()
76+
77+
fig, ax = plt.subplots()
78+
ax.add_patch(patch)
79+
ax.autoscale_view()
7980
plt.show()
8081

8182
# %%

0 commit comments

Comments
 (0)