日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

seaborn常用的10种数据分析图表

發(fā)布時(shí)間:2024/9/15 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 seaborn常用的10种数据分析图表 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

內(nèi)置示例數(shù)據(jù)集

seaborn內(nèi)置了十幾個(gè)示例數(shù)據(jù)集,通過(guò)load_dataset函數(shù)可以調(diào)用。

其中包括常見的泰坦尼克、鳶尾花等經(jīng)典數(shù)據(jù)集。

#?查看數(shù)據(jù)集種類 import?seaborn?as?sns sns.get_dataset_names() import?seaborn?as?sns #?導(dǎo)出鳶尾花數(shù)據(jù)集 data?=?sns.load_dataset('iris') data.head()

1、散點(diǎn)圖

函數(shù)sns.scatterplot

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline #?小費(fèi)數(shù)據(jù)集 tips?=?sns.load_dataset('tips') ax?=?sns.scatterplot(x='total_bill',y='tip',data=tips) plt.show()

2、條形圖

函數(shù)sns.barplot

顯示數(shù)據(jù)平均值和置信區(qū)間

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline #?小費(fèi)數(shù)據(jù)集 tips?=?sns.load_dataset("tips") ax?=?sns.barplot(x="day",?y="total_bill",?data=tips) plt.show()

3、線型圖

函數(shù)sns.lineplot

繪制折線圖和置信區(qū)間

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline fmri?=?sns.load_dataset("fmri") ax?=?sns.lineplot(x="timepoint",?y="signal",?data=fmri) plt.show()

4、箱線圖

函數(shù)seaborn.boxplot

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline tips?=?sns.load_dataset("tips") ax?=?sns.boxplot(x="day",?y="total_bill",?data=tips) plt.show()

5、直方圖

函數(shù)seaborn.distplot

import?seaborn?as?sns import?numpy?as?np sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline np.random.seed(0) x?=?np.random.randn(1000) ax?=?sns.distplot(x) plt.show()

6、熱力圖

函數(shù)seaborn.heatmap

import?numpy?as?np np.random.seed(0) import?seaborn?as?sns? sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline uniform_data?=?np.random.rand(10,?12) ax?=?sns.heatmap(uniform_data) plt.show()

7、散點(diǎn)圖矩陣

函數(shù)sns.pairplot

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline iris?=?sns.load_dataset("iris") ax?=?sns.pairplot(iris) plt.show()

8、分類散點(diǎn)圖

函數(shù)seaborn.catplot

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline exercise?=?sns.load_dataset("exercise") ax?=?sns.catplot(x="time",?y="pulse",?hue="kind",?data=exercise)\ plt.show()

9、計(jì)數(shù)條形圖

函數(shù)seaborn.countplot

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline titanic?=?sns.load_dataset("titanic") ax?=?sns.countplot(x="class",?data=titanic) plt.show()

10、回歸圖

函數(shù) seaborn.lmplot

繪制散點(diǎn)及回歸圖

import?seaborn?as?sns sns.set() import?matplotlib.pyplot?as?plt %matplotlib?inline tips?=?sns.load_dataset("tips") ax?=?sns.lmplot(x="total_bill",?y="tip",?data=tips)plt.show()

? ???精 彩 文 章?

  • 字節(jié)跳動(dòng)只剩下小米這一個(gè)朋友了

  • WebStorm超好用的10款插件,效率提升了好多!

  • 一文看懂:網(wǎng)址,URL,域名,IP地址,DNS,域名解析

END

來(lái)和小伙伴們一起向上生長(zhǎng)呀~~~

掃描下方二維碼,添加小詹微信,可領(lǐng)取千元大禮包并申請(qǐng)加入 Python學(xué)習(xí)交流群,群內(nèi)僅供學(xué)術(shù)交流,日常互動(dòng),如果是想發(fā)推文、廣告、砍價(jià)小程序的敬請(qǐng)繞道!一定記得備注「交流學(xué)習(xí)」,我會(huì)盡快通過(guò)好友申請(qǐng)哦!

(添加人數(shù)較多,請(qǐng)耐心等待)

(掃碼回復(fù) 1024? 即可領(lǐng)取IT資料包)

總結(jié)

以上是生活随笔為你收集整理的seaborn常用的10种数据分析图表的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。