而不是颜色是green对于整个直方图,我希望列遵循cm中定义的颜色图给出的颜色编码和bins的值---。这意味着根据所选的颜色RdYlBu_r,接近零的箱子(不是在高度上而是在位置上)应该看起来更蓝,而接近一个的箱子看起来更红。 由于plt.histo不采用cmap参数,我不知道如何告诉它使用cm中定义的颜色图 hist命令返回补丁列表...
importmatplotlib.pyplotaspltimportnumpyasnp# 创建数据x=np.linspace(-3,3,100)y=np.linspace(-3,3,100)X,Y=np.meshgrid(x,y)Z=np.sin(X)*np.cos(Y)# 绘制等高线图plt.figure(figsize=(8,6))contour=plt.contourf(X,Y,Z,cmap='RdYlBu_r',levels=20)plt.colorbar(contour,label='Value')plt.t...
.yaxis.set_major_formatter(LatitudeFormatter())# 添加底图long=np.linspace(72,136,128);lat=np.linspace(18,54,72)im=ax.contourf(long,lat[::-1],prcp1,levels=np.linspace(0,2000,11),cmap='RdYlBu_r',extend='both',alpha=0.8)cbar=fig.colorbar(im,ax=ax,shrink=0.9,pad=0.1,orientation...
alpha:用于指定等高线的透明度。 importmatplotlib.pyplotaspltimportnumpyasnp# 创建二维数据x=np.linspace(-2,2,100)y=np.linspace(-2,2,100)X,Y=np.meshgrid(x,y)Z=X**2+Y**2# 示例函数,可以根据需要自定义# 绘制等高线图plt.contour(X,Y,Z,levels=np.linspace(0,8,16+1),cmap='RdYlBu_r')# ...
cmap=plt.get_cmap('RdYlBu_r')#'RdYlBu_r' cb=ax.contourf(x,y,w,cmap=cmap,levels=np.arange(0,1,0.01)) ax.set_extent([100,175,-10.125,65]) ax.quiver(lons[::6,::6], lats[::6,::6], u_mean[::6,::6]*1.5,v_mean[::6,::6]*1.5,pivot='mid',\ ...
scale = '50m'xstep, ystep = 45, 35# cmap=plt.get_cmap('rainbow')#'RdYlBu_r'cmap=cmaps.NCV_jetfig=plt.figure(figsize=(20,16))ax=fig.add_subplot(121,projection=ccrs.PlateCarree(central_longitude=180))make_map(ax,'SST-Mask data')ax.contourf(lon,lat,sst_m,cmap=cmap,transform=ccrs...
PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, ...
RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1, Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Vega10, Vega10_r, Vega20, Vega20_r, Vega20b, Vega20b_r, Vega20c, Vega20c_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r,YlOrBr, YlOrBr...
rgb = ls.shade(z, plt.cm.RdYlBu) ax.plot_surface(x, y, z, facecolors=rgb) AI代码助手复制代码 五、使用Mayavi实现更逼真效果 5.1 基本花朵绘制 frommayaviimportmlab mlab.figure(size=(800,600)) r =flower_radius(theta, phi) mlab.mesh(x, y, z, colormap='cool', opacity=0.9) ...
('RdYlBu_r')#'RdYlBu_r'# ===data===day=(np.arange(19,31))da = xr.open_dataset(path+str1).sortby("latitude", ascending= True)da2=xr.open_dataset(path+str2).sortby("latitude", ascending= True)###reverse###lon_n 绘制结果如下图所示:...