8000 Merge pull request #25505 from rcomer/markers-examples · matplotlib/matplotlib@31d83a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 31d83a8

Browse files
authored
Merge pull request #25505 from rcomer/markers-examples
DOC: combine marker examples
2 parents 0b4e615 + 8696168 commit 31d83a8

File tree

2 files changed

+16
-64
lines changed

2 files changed

+16
-64
lines changed

galleries/examples/lines_bars_and_markers/scatter_custom_symbol.py

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

galleries/examples/lines_bars_and_markers/scatter_star_poly.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
66
Example with different ways to specify markers.
77
8-
For a list of all markers see also the `matplotlib.markers` documentation.
8+
See also the `matplotlib.markers` documentation for a list of all markers and
9+
:doc:`/gallery/lines_bars_and_markers/marker_reference` for more information
10+
on configuring markers.
11+
12+
.. redirect-from:: /gallery/lines_bars_and_markers/scatter_custom_symbol
13+
.. redirect-from:: /gallery/lines_bars_and_markers/scatter_symbol
14+
.. redirect-from:: /gallery/lines_bars_and_markers/scatter_piecharts
915
"""
1016
import matplotlib.pyplot as plt
1117
import numpy as np
@@ -17,32 +23,31 @@
1723
y = np.random.rand(10)
1824
z = np.sqrt(x**2 + y**2)
1925

20-
fig, axs = plt.subplots(2, 3, sharex=True, sharey=True)
26+
fig, axs = plt.subplots(2, 3, sharex=True, sharey=True, layout="constrained")
2127

22-
# marker symbol
28+
# Matplotlib marker symbol
2329
axs[0, 0].scatter(x, y, s=80, c=z, marker=">")
2430
axs[0, 0].set_title("marker='>'")
2531

26-
# marker from TeX
27-
axs[0, 1].scatter(x, y, s=80, c=z, marker=r'$\alpha$')
28-
axs[0, 1].set_title(r"marker=r'\$\alpha\$'")
32+
# marker from TeX: passing a TeX symbol name enclosed in $-signs
33+
axs[0, 1].scatter(x, y, s=80, c=z, marker=r"$\clubsuit$")
34+
axs[0, 1].set_title(r"marker=r'\$\clubsuit\$'")
2935

30-
# marker from path
36+
# marker from path: passing a custom path of N vertices as a (N, 2) array-like
3137
verts = [[-1, -1], [1, -1], [1, 1], [-1, -1]]
3238
axs[0, 2].scatter(x, y, s=80, c=z, marker=verts)
3339
axs[0, 2].set_title("marker=verts")
3440

35-
# regular polygon marker
41+
# regular pentagon marker
3642
axs[1, 0].scatter(x, y, s=80, c=z, marker=(5, 0))
3743
axs[1, 0].set_title("marker=(5, 0)")
3844

39-
# regular star marker
45+
# regular 5-pointed star marker
4046
axs[1, 1].scatter(x, y, s=80, c=z, marker=(5, 1))
4147
axs[1, 1].set_title("marker=(5, 1)")
4248

43-
# regular asterisk marker
49+
# regular 5-pointed asterisk marker
4450
axs[1, 2].scatter(x, y, s=80, c=z, marker=(5, 2))
4551
axs[1, 2].set_title("marker=(5, 2)")
4652

47-
plt.tight_layout()
4853
plt.show()

0 commit comments

Comments
 (0)
0