Skip to content

Commit 353ea06

Browse files
committed
Cleanup and move path_patch demo
1 parent 38fbb21 commit 353ea06

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

doc/users/screenshots.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Path demo
4343
You can add arbitrary paths in matplotlib as of release 0.98. See
4444
the :mod:`matplotlib.path`.
4545

46-
.. plot:: mpl_examples/api/path_patch_demo.py
46+
.. plot:: mpl_examples/shapes_and_collections/path_patch_demo.py
4747

4848
.. _screenshots_mplot3d_surface:
4949

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import numpy as np
1+
"""
2+
Demo of a PathPatch object.
3+
"""
24
import matplotlib.path as mpath
35
import matplotlib.patches as mpatches
46
import matplotlib.pyplot as plt
57

6-
Path = mpath.Path
78

8-
fig = plt.figure()
9-
ax = fig.add_subplot(111)
9+
fig, ax = plt.subplots()
1010

11-
pathdata = [
11+
Path = mpath.Path
12+
path_data = [
1213
(Path.MOVETO, (1.58, -2.57)),
1314
(Path.CURVE4, (0.35, -1.1)),
1415
(Path.CURVE4, (-1.75, 2.0)),
@@ -19,18 +20,15 @@
1920
(Path.CURVE4, (2.0, -0.5)),
2021
(Path.CLOSEPOLY, (1.58, -2.57)),
2122
]
22-
23-
codes, verts = zip(*pathdata)
23+
codes, verts = zip(*path_data)
2424
path = mpath.Path(verts, codes)
25-
patch = mpatches.PathPatch(path, facecolor='red', edgecolor='yellow', alpha=0.5)
25+
patch = mpatches.PathPatch(path, facecolor='r', alpha=0.5)
2626
ax.add_patch(patch)
2727

28+
# plot control points and connecting lines
2829
x, y = zip(*path.vertices)
2930
line, = ax.plot(x, y, 'go-')
31+
3032
ax.grid()
31-
ax.set_xlim(-3,4)
32-
ax.set_ylim(-3,4)
33-
ax.set_title('spline paths')
33+
ax.axis('equal')
3434
plt.show()
35-
36-

examples/tests/backend_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
]
5858

5959
files['shapes'] = [
60+
'path_patch_demo.py',
6061
'scatter_demo.py',
6162
]
6263

@@ -267,7 +268,6 @@
267268
'logo2.py',
268269
'mathtext_asarray.py',
269270
'patch_collection.py',
270-
'path_patch_demo.py',
271271
'quad_bezier.py',
272272
'scatter_piecharts.py',
273273
'span_regions.py',

0 commit comments

Comments
 (0)