cmap = plt.cm.get_cmap('viridis') # 这里使用'viridis'作为示例,你可以根据需要选择其他颜色映射 绘制图表并设置颜色映射: 代码语言:txt 复制 plt.scatter(data, data, c=data, cmap=cmap) plt.colorbar() # 添加颜色条 plt.show() 在上述代码中,我们使用scatter函数绘制散点图,并通过设置c参数为数组dat...
importmatplotlib.pyplotasplt# 创建一个cmap实例cmap=plt.cm.get_cmap('viridis')# 获取cmap的颜色参数colors=cmap(np.linspace(0,1,10))# 将颜色参数转换为16进制表示hex_colors=[matplotlib.colors.rgb2hex(color)forcolorincolors]# 输出转换后的颜色参数forcolorinhex_colors:print(color) 1. 2. 3. 4....
cmap = cm.get_cmap('Spectral') df.plot.scatter(x='sepal length (cm)', y='sepal width (cm)', s=df[['petal length (cm)']]*20, c=df['target'], cmap=cmap, title='different circle size by petal length (cm)') 3.直方图、长条图 直方图(Histogram Chart)通常用于同一栏位,呈现连续数...
python画图colorbar颜色大全plt.cm.get_cmap python画图colorbar颜⾊⼤全plt.cm.get_cmap 名字后_r取反
pole = ax.pot_surface(x2, y2, z2, cmap=cm.get_cmap('summer') ) #cmap=cm.get_cmap('Greens'),cmap=cm.get_cmap('summer'),color='g' plt.axis('off') fig.savefig('redRose.png', transparent=True) plt.show() 3)效果展示
sc = plt.scatter(xy, xy, c=z, vmin=0, vmax=20, s=35, cmap=cm) plt.colorbar(sc) plt.show() 1. 2. 3. 4. 5. 6. 7. 其中get_cmap中取值可为:Possible values are: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r,...
(7,5))cm=plt.cm.get_cmap('RdBu')sc=plt.scatter(data['alcohol'],data['volatile acidity'],c=data['quality'],vmin=3,vmax=8,s=15,cmap=cm)bar=plt.colorbar(sc)bar.set_label('quality',rotation=0)plt.xlabel('alcohol')plt.ylabel('volatile acidity')plt.xlim(7,16)plt.ylim(0,2)plt...
sc = plt.scatter(xy, xy, c=z, vmin=0, vmax=20, s=35, cmap=cm) plt.colorbar(sc) plt.show() 其中get_cmap中取值可为:Possible values are: Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu...
c= cm.get_cmap('spring_r') surf = ax.plot_surface(r * np.cos(t), r * np.sin(t), h, rstride=1, cstride=1, cmap= c, linewidth=0, antialiased=True) plt.show() 四、玫瑰花绘制—红色 # 省略了头文件,可以在之前的博客里看到 ...
cmap=cm.get_cmap('Spectral')df.plot.scatter(x='sepal length (cm)',y='sepal width (cm)',s=df[['petal length (cm)']]*20,c=df['target'],cmap=cmap,title='different circle size by petal length (cm)') 3.直方图、长条图 直方图(Histogram Chart)通常用于同一栏位,呈现连续数据的分布状况...