我有一个垂直经度和压力水平的 matplotlib contourf 图。我正在尝试使用 matplotlib 中的 plt.streamplot 函数并使用 U 和 V 风数据来绘制流线。如果我只绘制流图,它工作正常。但我无法让流线覆盖在等高线图上。这是我的代码:-
fig, axes = plt.subplots(nrows, ncols, sharex=True, sharey=True)
if (nrows==1 and ncols==1):
axes=[axes]
else:
axes=axes.flat
for i, ax in enumerate(axes):
X,Y = np.meshgrid(x[i],y[i])
levels=np.arange(vmin,vmax,step)
h = ax.contourf(X,Y,z[i],cmap=cmap,levels=levels,extend='both')
w = ax.streamplot(X, Y, W[i], Z[i], linewidth=0.2, color='gray')
这是我得到的情节:
下面是流线图,不知道为什么y轴是0-120而不是0-1000: