seaborn 与 iris 数据集


简易用法

sns.scatterplot(x='sepal_length', y='sepal_width', data=df, hue='species', style='species')
sns.lineplot(x=np.linspace(0, 1, 10), y=np.random.rand(10))
sns.relplot(x='sepal_length', y='sepal_width', data=df, hue='species', style='species', col='species')
sns.stripplot(x='species', y='sepal_width', data=df, hue='species', size=4)
sns.swarmplot(x='species', y='sepal_width', data=df, hue='species', size=4)
sns.boxplot(x='species', y='sepal_width', data=df, hue='species')
sns.violinplot(x='species', y='sepal_width', data=df, hue='species')
sns.barplot(x='species', y='sepal_width', data=df, hue='species')
sns.distplot(df.sepal_length, bins=50, rug=True)
sns.kdeplot(df.sepal_length, df.sepal_width, shade=True, cbar=True, cmap='Reds')
sns.jointplot(df.sepal_length, df.sepal_width, kind='kde')
sns.pairplot(df, hue="species")
sns.heatmap(np.random.randn(8, 8), annot=True, annot_kws={'size':9,'weight':'bold', 'color':'w'}, fmt='.2f')
sns.clustermap(df.iloc[:, :4])

Relational plots(关系图)

scatterplot(散点图)

scatterplot.png

sns.scatterplot(x='sepal_length', y='sepal_width', data=df, hue='species', style='species')

lineplot(线图)

sns.lineplot(x=np.linspace(0, 1, 10), y=np.random.rand(10))

relplot(关系图)

relplot.png

sns.relplot(x='sepal_length', y='sepal_width', data=df, hue='species', style='species', col='species')

Categorical plots(分类图)

Categorical scatterplots(分类散点图)

stripplot(分布散点图)

stripplot.png

sns.stripplot(x='species', y='sepal_width', data=df, hue='species', size=4)

swarmplot(分布密度散点图)

swarmplot.png

sns.swarmplot(x='species', y='sepal_width', data=df, hue='species', size=4)

Categorical distribution plots(分类分布图)

boxplot(箱线图)

boxplot.png

sns.boxplot(x='species', y='sepal_width', data=df, hue='species')

violinplot(小提琴图)

violinplot.png

sns.violinplot(x='species', y='sepal_width', data=df, hue='species')

Categorical estimate plots(分类估计图)

barplot(条形图)

barplot.png

sns.barplot(x='species', y='sepal_width', data=df, hue='species')

Distribution plots(分布图)

distplot(直方图)

distplot.png

sns.distplot(df.sepal_length, bins=50, rug=True)

kdeplot(核密度图)

kdeplot.png

sns.kdeplot(df.sepal_length, df.sepal_width, shade=True, cbar=True, cmap='Reds')

jointplot(联合分布图)

jointplot.png

sns.jointplot(df.sepal_length, df.sepal_width, kind='kde')

pairplot(变量关系组图)

pairplot.png

sns.pairplot(df, hue="species")

Matrix plots(矩阵图)

heatmap(热力图)

heatmap.png

data = np.random.randn(8, 8)
sns.heatmap(data, annot=True, annot_kws={'size':9,'weight':'bold', 'color':'w'}, fmt='.2f')

clustermap(聚类图)

clustermap.png

sns.clustermap(df.iloc[:, :4])


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM