FiveThirtyEight样式表

这显示了“fivethirtyeight”样式的一个示例,它试图从FiveThirtyEight.com复制样式。

FiveThirtyEight样式表示例

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. plt.style.use('fivethirtyeight')
  4. x = np.linspace(0, 10)
  5. # Fixing random state for reproducibility
  6. np.random.seed(19680801)
  7. fig, ax = plt.subplots()
  8. ax.plot(x, np.sin(x) + x + np.random.randn(50))
  9. ax.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50))
  10. ax.plot(x, np.sin(x) + 2 * x + np.random.randn(50))
  11. ax.plot(x, np.sin(x) - 0.5 * x + np.random.randn(50))
  12. ax.plot(x, np.sin(x) - 2 * x + np.random.randn(50))
  13. ax.plot(x, np.sin(x) + np.random.randn(50))
  14. ax.set_title("'fivethirtyeight' style sheet")
  15. plt.show()

下载这个示例