星标记散点图

创建多个具有不同星号符号的散点图。

星标记散点图示例

  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. # Fixing random state for reproducibility
  4. np.random.seed(19680801)
  5. x = np.random.rand(10)
  6. y = np.random.rand(10)
  7. z = np.sqrt(x**2 + y**2)
  8. plt.subplot(321)
  9. plt.scatter(x, y, s=80, c=z, marker=">")
  10. plt.subplot(322)
  11. plt.scatter(x, y, s=80, c=z, marker=(5, 0))
  12. verts = np.array([[-1, -1], [1, -1], [1, 1], [-1, -1]])
  13. plt.subplot(323)
  14. plt.scatter(x, y, s=80, c=z, marker=verts)
  15. plt.subplot(324)
  16. plt.scatter(x, y, s=80, c=z, marker=(5, 1))
  17. plt.subplot(325)
  18. plt.scatter(x, y, s=80, c=z, marker='+')
  19. plt.subplot(326)
  20. plt.scatter(x, y, s=80, c=z, marker=(5, 2))
  21. plt.show()

下载这个示例