我有以下几行代码来生成热图(pcolormesh
)。
import matplotlib.pyplot as plt
import numpy as np
vals = np.linspace(-np.pi/2, np.pi/2, 101)
x, y = np.meshgrid(vals, vals)
z = np.abs(np.sinc(x) * np.sinc(y))
xDeg = np.rad2deg(x)
yDeg = np.rad2deg(y)
plt.pcolormesh(xDeg, yDeg, z, cmap = 'jet', vmin = 0, vmax = 1)
plt.colorbar()
plt.axis([-90, 90, -90, 90])
ticks = np.linspace(-90, 90, 13)
plt.xticks(ticks)
plt.yticks(ticks)
print np.mean(z) # 0.186225110029
print np.sqrt(np.mean(z**2)) # 0.295710882276
plt.show()
我想放置:
任何输入?
答案 0 :(得分:5)