plt,sns画图

plt 前设置

#设置seaborn默认背景色
sns.set(style='darkgrid') 
plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']  # 中文字体设置-黑体

#这里style可选参数值有:darkgrid,whitegrid,dark,white,ticks

plt 图设置

plt.figure(figsize=(8, 4))
# 600 x 600 像素(先宽度 后高度)

plt.plot( x = ,y = ,color = "b", alpha=0.8)
#alpha是颜色透明度

plt.legend(labels=('1','2','3', ‘4'),fontsize=8,loc='lower right') 
#图例设置

plt.xlabel('Cycle Number',color='k')
plt.ylabel('Q_loss / %',color='k')#fontsize=20
#坐标轴设置

plt.xticks(x) 
#坐标轴设置为整数显示

sns图设置

趋势线

sns.lineplot 线形图

描述变量之间的关系

sns.barplot 条形图
sns.heatmap 热力图
sns.scatterplot 散点图
sns.regplot 包含趋势线的散点图
sns.lmplot 包含多条趋势线的散点图
sns.swarmplot 包含分类变量的散点图
sns.pointplot 点图

分布图

sns.histplot 直方图
sns.kdeplot 核密度图
sns.jointplot 用来展示两个相关的核密度图
sns.boxplot 箱线图
sns.countplot 计数图

多图组合

sns.FacetGrid 图表网格

g=sns.FacetGrid(data, col="species",height=4,hue='species')
g.map(sns.histplot, "petal_length")

在这里插入图片描述
sns.jointplot 联合分布图

sns.jointplot(x="sepal_length", y="sepal_width", data=data,
                                  palette='Set2',hue='species')

在这里插入图片描述
sns.catplot cat图

 sns.catplot(data=data, x="petal_length", y="species", kind="violin", color=".9", inner=None)
 sns.swarmplot(data=data, x="petal_length", y="species", size=3)

在这里插入图片描述

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值