seaborn库学习—-分布图displot、histplot、kdeplot、ecdfplot

提供的api说明
displotFigure-level interface for drawing distribution plots onto a FacetGrid. 图形级界面,用于在FacetGrid上绘制分布图。
histplotPlot univariate or bivariate histograms to show distributions of datasets. 绘制单变量或双变量直方图来显示数据集的分布。
kdeplotPlot univariate or bivariate distributions using kernel density estimation. 使用核密度估计绘制单变量或双变量分布
ecdfplotPlot empirical cumulative distribution functions.绘制经验累积分布函数。
rugplotPlot marginal distributions by drawing ticks along the x and y axes. 通过在x和y轴上画刻度来绘制边缘分布。
distplotDEPRECATED: Flexibly plot a univariate distribution of observations. :灵活地绘制观测数据的单变量分布。

displot

语法

seaborn.displot(data=Node,*, x=None, y=None, hue=None, row=None, col=None, weights=None, kind='hist', 
rug=False, rug_kws=None, log_scale=None, legend=True, palette=None, hue_order=None, hue_norm=None, 
color=None, col_wrap=None, row_order=None, col_order=None, height=5, aspect=1, facet_kws=None, **kwargs)

这个函数提供了几种可视化数据的单变量或双变量分布的方法,包括通过语义映射和跨多个子图分面定义的数据子集。
通过kind参数,选择不同的方法:

参数说明

举例

#可以加载anaconda中sns库自己带的一些数据源 进行示例。  
penguins = sns.load_dataset("penguins")
sns.displot(data=penguins, x="flipper_length_mm")

seaborn库学习----分布图displot、histplot、kdeplot、ecdfplot
seaborn库学习----分布图displot、histplot、kdeplot、ecdfplot
使用kind=‘kde’参数来显示核密度估计,(kernel density estimates);
seaborn库学习----分布图displot、histplot、kdeplot、ecdfplot
使用kind=’ecdf’参数来显示经验累积分布函数(empirical cumulative distribution functions)
seaborn库学习----分布图displot、histplot、kdeplot、ecdfplot
同时也可以在直方图中,显示核密度估计
seaborn库学习----分布图displot、histplot、kdeplot、ecdfplot
绘制一个二元分析图,将x和y都赋值:
这幅图片里面内容不是很有意义,但是也能看得出pCO2值与year的变化与分布;
seaborn库学习----分布图displot、histplot、kdeplot、ecdfplot目前,二元分析图仅适用于直方图和KDEs: 当然也可以使用kdes方式来画二元分析图,可以发现数据的分布情况;
seaborn库学习----分布图displot、histplot、kdeplot、ecdfplot

关于其他函数的讲解

还有其他API:histplot,kdeplot。。。读者可以参考下面网址。
这些画图工具能画出来太多的图了,但是基本上用法大家都清楚。

https://seaborn.pydata.org/api.html#categorical-plots

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
社会演员多的头像社会演员多普通用户
上一篇 2023年3月28日
下一篇 2023年3月28日

相关推荐