三叶草样式的散点图

用三叶草符号表示散点图。

三叶草样式的散点图示例

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. # Fixing random state for reproducibility
  4. np.random.seed(19680801)
  5. x = np.arange(0.0, 50.0, 2.0)
  6. y = x ** 1.3 + np.random.rand(*x.shape) * 30.0
  7. s = np.random.rand(*x.shape) * 800 + 500
  8. plt.scatter(x, y, s, c="g", alpha=0.5, marker=r'$\clubsuit$',
  9. label="Luck")
  10. plt.xlabel("Leprechauns")
  11. plt.ylabel("Gold")
  12. plt.legend(loc='upper left')
  13. plt.show()

下载这个示例