散点图自定义符号

在散点图中创建自定义椭圆符号。

散点图自定义符号示例

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. # unit area ellipse
  4. rx, ry = 3., 1.
  5. area = rx * ry * np.pi
  6. theta = np.arange(0, 2 * np.pi + 0.01, 0.1)
  7. verts = np.column_stack([rx / area * np.cos(theta), ry / area * np.sin(theta)])
  8. x, y, s, c = np.random.rand(4, 30)
  9. s *= 10**2.
  10. fig, ax = plt.subplots()
  11. ax.scatter(x, y, s, c, marker=verts)
  12. plt.show()

下载这个示例