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()


沒有留言:

張貼留言

WOKWI ESP32 LED Control , Node-Red MQTT SQLITE  

WOKWI ESP32 LED Control ,  Node-Red  MQTT SQLITE   const char broker[] = "test.mosquitto.org" ; //const char broker[] = "br...