## import matplotlib
matplotlib as mpl
## Set colormap for the colorbar
cmap = mpl.cm.rainbow
#### Use norm to set you vmax and vmin
norm = mpl.colors.Normalize(vmin=0, vmax=35)
## Pass norm as argument while plotting
strm = ax.streamplot(x=ds["longitude"],y=ds["latitude"], u=ds["u"], v=ds["v"], color=ds.u.values, linewidth=1, cmap='rainbow', density=0.6, norm=norm)
fig.colorbar(strm.lines, label = 'wind speed [m$^2$]', shrink=0.6)
1条答案
按热度按时间wko9yo5t1#
我想这个应该会有帮助。