Skip to content

Commit 75441ce

Browse files
committed
DOC: Remove extra imports from paths tutorial
1 parent babd065 commit 75441ce

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

galleries/users_explain/artists/paths.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
could use this code:
1919
"""
2020

21+
import numpy as np
22+
2123
import matplotlib.pyplot as plt
2224

2325
import matplotlib.patches as patches
@@ -191,11 +193,6 @@
191193
# edgecolor='yellow', alpha=0.5)
192194
# ax.add_patch(patch)
193195

194-
import numpy as np
195-
196-
import matplotlib.patches as patches
197-
import matplotlib.path as path
198-
199196
fig, ax = plt.subplots()
200197
# Fixing random state for reproducibility
201198
np.random.seed(19680801)
@@ -213,9 +210,9 @@
213210

214211
nverts = nrects*(1+3+1)
215212
verts = np.zeros((nverts, 2))
216-
codes = np.ones(nverts, int) * path.Path.LINETO
217-
codes[0::5] = path.Path.MOVETO
218-
codes[4::5] = path.Path.CLOSEPOLY
213+
codes = np.full(nverts, Path.LINETO, dtype=int)
214+
codes[0::5] = Path.MOVETO
215+
codes[4::5] = Path.CLOSEPOLY
219216
verts[0::5, 0] = left
220217
verts[0::5, 1] = bottom
221218
verts[1::5, 0] = left
@@ -225,7 +222,7 @@
225222
verts[3::5, 0] = right
226223
verts[3::5, 1] = bottom
227224

228-
barpath = path.Path(verts, codes)
225+
barpath = Path(verts, codes)
229226
patch = patches.PathPatch(barpath, facecolor='green',
230227
edgecolor='yellow', alpha=0.5)
231228
ax.add_patch(patch)

0 commit comments

Comments
 (0)