7

【丢弃】【Python】【seaborn】绘图示例

 3 years ago
source link: https://www.guofei.site/2017/10/01/seabron.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【丢弃】【Python】【seaborn】绘图示例

2017年10月01日

Author: Guofei

文章归类: ,文章编号: 751


版权声明:本文作者是郭飞。转载随意,但需要标明原文链接,并通知本人
原文链接:https://www.guofei.site/2017/10/01/seabron.html

Edit

回收原因:主要用法写在了这里, 更多用法看看官网很快就可以上手

seaborn的特点

  • 基于matplotlib进行了更高级的封装
  • 高度兼容numpy,pandas,scipy,statsmodels

distplot()

from scipy import stats
import matplotlib.pyplot as plt  # 导入
import seaborn as sns

fig,ax=plt.subplots(2,1)
x = stats.norm.rvs(loc=0, scale=1, size=100)
sns.distplot(x, bins=20, kde=True, hist=True, rug=True, fit=stats.gamma,ax=ax[0]);
# bins直方图多少个矩阵条
# hist=True显示直方图
# kde=True 显示核密度分布图
# fit=stats.gamma 拟合
# rug=True 在x轴上显示每个观测上生成的小细条(边际毛毯)

sns.distplot(x, hist=False, color="g", kde_kws={"shade": True}, ax=ax[1])
# kde图上阴影
plt.show()

displot的输入参数 解释 bins 直方图多少个矩阵条 hist 是否显示直方图 ked 是否显示核密度估计图 fit 是否显示拟合图 rug 是否显示边际毛毯

seaborn1_1.png


您的支持将鼓励我继续创作!

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK