2018年1月23日 星期二

直方圖(Histogram)


直方圖(Histogram)

Python

使用 matplotlib.pyplot 的 hist() 方法。
import numpy as np import matplotlib.pyplot as plt normal_samples = np.random.normal(size = 100000) # 生成 100000 組標準常態分配(平均值為 0,標準差為 1 的常態分配)隨機變數 uniform_samples = np.random.uniform(size = 100000) # 生成 100000 組介於 0 與 1 之間均勻分配隨機變數 plt.hist(normal_samples) plt.show() plt.hist(uniform_samples) plt.show()


沒有留言:

張貼留言

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...