8000 Move the marker path example into the marker reference · matplotlib/matplotlib@d0ac2e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0ac2e5

Browse files
committed
Move the marker path example into the marker reference
1 parent 831a13c commit d0ac2e5

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed

examples/lines_bars_and_markers/marker_reference.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
- `Unfilled markers`_
1010
- `Filled markers`_
1111
- `Markers created from TeX symbols`_
12-
- Custom markers can be created from paths. See
13-
:doc:`/gallery/shapes_and_collections/marker_path`.
12+
- `Markers created from Paths`_
1413
1514
For a list of all markers see also the `matplotlib.markers` documentation.
1615
1716
For example usages see
1817
:doc:`/gallery/lines_bars_and_markers/scatter_star_poly`.
18+
19+
.. redirect-from:: /gallery/shapes_and_collections/marker_path
1920
"""
2021

2122
import matplotlib.pyplot as plt
@@ -126,3 +127,35 @@ def split_list(a_list):
126127
format_axes(ax)
127128

128129
plt.show()
130+
131+
132+
###############################################################################
133+
# Markers created from Paths
134+
# ==========================
135+
#
136+
# Any `~.path.Path` can be used as a marker. The following example shows two
137+
# simple paths *star* and *circle*, and a more elaborate path of a circle with
138+
# a cut-out star.
139+
140+
import matplotlib.path as mpath
141+
import numpy as np
142+
143+
star = mpath.Path.unit_regular_star(6)
144+
circle = mpath.Path.unit_circle()
145+
# concatenate the circle with an internal cutout of the star
146+
cut_star = mpath.Path(
147+
vertices=np.concatenate([circle.vertices, star.vertices[::-1, ...]]),
148+
codes=np.concatenate([circle.codes, star.codes]))
149+
150+
fig, ax = plt.subplots()
151+
fig.suptitle('Path markers', fontsize=14)
152+
fig.subplots_adjust(left=0.4)
153+
154+
markers = {'star': star, 'circle': circle, 'cut_star': cut_star}
155+
156+
for y, (name, marker) in enumerate(markers.items()):
157+
ax.text(-0.5, y, name, **text_style)
158+
ax.plot([y] * 3, marker=marker, **marker_style)
159+
format_axes(ax)
160+
161+
plt.show()

examples/shapes_and_collections/marker_path.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

lib/matplotlib/markers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
Examples showing the use of markers:
8484
8585
* :doc:`/gallery/lines_bars_and_markers/marker_reference`
86-
* :doc:`/gallery/shapes_and_collections/marker_path`
8786
* :doc:`/gallery/lines_bars_and_markers/scatter_star_poly`
8887
8988

0 commit comments

Comments
 (0)
0