📜  计算 x 和 y 的二维直方图. - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:35.743000             🧑  作者: Mango

代码示例1
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

xedges = [0, 1, 2, 3]
yedges = [0, 1, 2, 3, 4]
x = np.array([0, 0.1, 0.2, 1., 1.1, 2., 2.1])
y = np.array([0, 0.1, 0.2, 1., 1.1, 2., 3.3])

out = np.histogram2d(x, y, bins=(xedges, yedges))

plt.scatter(x, y)
plt.grid()