Python数据中的二维网格数据可视化

时间:2018-02-09 15:16:40

标签: python numpy matplotlib histogram seaborn

如何在Python中将3D数据绘制为2D网格图?

hist2D类似,其中第三维不是频率,而是我自己的数据。让我来说明一下:

import numpy as np
import matplotlib.pyplot as plt


# Making some points
npoints = 500
x = np.random.uniform(low=0, high=3, size=npoints)
y = np.random.uniform(low=-3, high=3, size=npoints)
z = np.random.uniform(low=0, high=10, size=npoints)

# plot X Y Z as a grid plot
# like plt.hist2d(x, y) but where frequency = z
plt.colorbar()
plt.show()

enter image description here

类似的问题,但没有帮助: Color 2D Grid with values from separate 2D array

0 个答案:

没有答案