Matplotlib 基础功能强但默认样式简陋Seaborn 在 Matplotlib 基础上封装了更漂亮的默认样式和更简洁的 API。一、安装pipinstallseaborn matplotlib pandas二、常用图表importseabornassnsimportmatplotlib.pyplotasplt sns.set_theme(stylewhitegrid)# 柱状图sns.barplot(x部门,y工资,datadf)plt.show()# 箱线图sns.boxplot(x部门,y工资,datadf)plt.show()# 热力图sns.heatmap(df.corr(),annotTrue,cmapcoolwarm)plt.show()三、样式定制sns.set_theme(styledarkgrid,paletteSet2,fontSimHei,font_scale1.2) 觉得有用的话点赞 关注【张老师技术栈】吧