Skip to content

Commit

Permalink
DOC: combine marker examples [ci doc]
Browse files Browse the repository at this point in the history
  • Loading branch information
rcomer committed Mar 20, 2023
1 parent 738ead8 commit 8696168
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 64 deletions.
53 changes: 0 additions & 53 deletions galleries/examples/lines_bars_and_markers/scatter_custom_symbol.py

This file was deleted.

27 changes: 16 additions & 11 deletions galleries/examples/lines_bars_and_markers/scatter_star_poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
Example with different ways to specify markers.
For a list of all markers see also the `matplotlib.markers` documentation.
See also the `matplotlib.markers` documentation for a list of all markers and
:doc:`/gallery/lines_bars_and_markers/marker_reference` for more information
on configuring markers.
.. redirect-from:: /gallery/lines_bars_and_markers/scatter_custom_symbol
.. redirect-from:: /gallery/lines_bars_and_markers/scatter_symbol
.. redirect-from:: /gallery/lines_bars_and_markers/scatter_piecharts
"""
import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -17,32 +23,31 @@
y = np.random.rand(10)
z = np.sqrt(x**2 + y**2)

fig, axs = plt.subplots(2, 3, sharex=True, sharey=True)
fig, axs = plt.subplots(2, 3, sharex=True, sharey=True, layout="constrained")

# marker symbol
# Matplotlib marker symbol
axs[0, 0].scatter(x, y, s=80, c=z, marker=">")
axs[0, 0].set_title("marker='>'")

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

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

# regular polygon marker
# regular pentagon marker
axs[1, 0].scatter(x, y, s=80, c=z, marker=(5, 0))
axs[1, 0].set_title("marker=(5, 0)")

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

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

plt.tight_layout()
plt.show()

0 comments on commit 8696168

Please sign in to comment.