Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
DOC: Remove extra imports from paths tutorial
  • Loading branch information
QuLogic committed Aug 31, 2023
commit 75441cee35c51f27f07952c1af3775ce160be71d
15 changes: 6 additions & 9 deletions galleries/users_explain/artists/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
could use this code:
"""

import numpy as np

import matplotlib.pyplot as plt

import matplotlib.patches as patches
Expand Down Expand Up @@ -191,11 +193,6 @@
# edgecolor='yellow', alpha=0.5)
# ax.add_patch(patch)

import numpy as np

import matplotlib.patches as patches
import matplotlib.path as path

fig, ax = plt.subplots()
# Fixing random state for reproducibility
np.random.seed(19680801)
Expand All @@ -213,9 +210,9 @@

nverts = nrects*(1+3+1)
verts = np.zeros((nverts, 2))
codes = np.ones(nverts, int) * path.Path.LINETO
codes[0::5] = path.Path.MOVETO
codes[4::5] = path.Path.CLOSEPOLY
codes = np.full(nverts, Path.LINETO, dtype=int)
codes[0::5] = Path.MOVETO
codes[4::5] = Path.CLOSEPOLY
verts[0::5, 0] = left
verts[0::5, 1] = bottom
verts[1::5, 0] = left
Expand All @@ -225,7 +222,7 @@
verts[3::5, 0] = right
verts[3::5, 1] = bottom

barpath = path.Path(verts, codes)
barpath = Path(verts, codes)
patch = patches.PathPatch(barpath, facecolor='green',
edgecolor='yellow', alpha=0.5)
ax.add_patch(patch)
Expand Down