import numpy as np
import matplotlib.pyplot as plt
# Fixing random state for reproducibility
np.random.seed(19800659)
N = 100
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = (40 * np.random.rand(N))**2 # 0 to 15 point radii
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.show()
#############################################################################
#
# .. admonition:: References
#
# The use of the following functions, methods, classes and modules is shown
# in this example:
#
# - `matplotlib.axes.Axes.scatter` / `matplotlib.pyplot.scatter`
【每天一个小样例】画散点图
于 2022-05-12 08:37:18 首次发布