如何在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()
类似的问题,但没有帮助: Color 2D Grid with values from separate 2D array