Frontpage 直方图示例

此示例再现Frontpage 直方图示例。

Frontpage 直方图示例

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. random_state = np.random.RandomState(19680801)
  4. X = random_state.randn(10000)
  5. fig, ax = plt.subplots()
  6. ax.hist(X, bins=25, density=True)
  7. x = np.linspace(-5, 5, 1000)
  8. ax.plot(x, 1 / np.sqrt(2*np.pi) * np.exp(-(x**2)/2), linewidth=4)
  9. ax.set_xticks([])
  10. ax.set_yticks([])
  11. fig.savefig("histogram_frontpage.png", dpi=25) # results in 160x120 px image

下载这个示例