Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Merge "Scatter Symbol" and "Scatter Custom Symbol" examples#22276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:mainfromtimhoffm:doc-scatter-symbol
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
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
37 changes: 31 additions & 6 deletionsexamples/lines_bars_and_markers/scatter_custom_symbol.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,43 @@
"""
=====================
Scatter Custom Symbol
=====================

Creating a custom ellipse symbol in scatter plot.
=================================
Scatter plots with custom symbols
=================================

.. redirect-from:: /gallery/lines_bars_and_markers/scatter_symbol
.. redirect-from:: /gallery/lines_bars_and_markers/scatter_piecharts
"""

##############################################################################
# Using TeX symbols
# -----------------
# An easy way to customize scatter symbols is passing a TeX symbol name
# enclosed in $-signs as a marker. Below we use ``marker=r'$\clubsuit$'``.

import matplotlib.pyplot as plt
import numpy as np


# Fixing random state for reproducibility
np.random.seed(19680801)


x = np.arange(0.0, 50.0, 2.0)
y = x ** 1.3 + np.random.rand(*x.shape) * 30.0
sizes = np.random.rand(*x.shape) * 800 + 500

fig, ax = plt.subplots()
ax.scatter(x, y, sizes, c="green", alpha=0.5, marker=r'$\clubsuit$',
label="Luck")
ax.set_xlabel("Leprechauns")
ax.set_ylabel("Gold")
ax.legend()
plt.show()

##############################################################################
# Using a custom path
# -------------------
# Alternatively, one can also pass a custom path of N vertices as a Nx2 array
# of x, y values as *marker*.

# unit area ellipse
rx, ry = 3., 1.
area = rx * ry * np.pi
Expand Down
52 changes: 0 additions & 52 deletionsexamples/lines_bars_and_markers/scatter_piecharts.py
View file
Open in desktop

This file was deleted.

25 changes: 0 additions & 25 deletionsexamples/lines_bars_and_markers/scatter_symbol.py
View file
Open in desktop

This file was deleted.


[8]ページ先頭

©2009-2025 Movatter.jp