好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > Python中seaborn庫之countplot的數據可視化使用

Python中seaborn庫之countplot的數據可視化使用

熱門標簽:海外網吧地圖標注注冊 南陽打電話機器人 ai電銷機器人的優勢 地圖標注自己和別人標注區別 騰訊地圖標注沒法顯示 打電話機器人營銷 商家地圖標注海報 孝感營銷電話機器人效果怎么樣 聊城語音外呼系統

在Python數據可視化中,seaborn較好的提供了圖形的一些可視化功效。

seaborn官方文檔見鏈接:http://seaborn.pydata.org/api.html

countplot是seaborn庫中分類圖的一種,作用是使用條形顯示每個分箱器中的觀察計數。接下來,對seaborn中的countplot方法進行詳細的一個講解,希望可以幫助到剛入門的同行。

導入seaborn庫

import seaborn as sns

使用countplot

sns.countplot()

countplot方法中必須要x或者y參數,不然就報錯。

官方給出的countplot方法及參數:

sns.countplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, dodge=True, ax=None, **kwargs)

下面講解countplot方法中的每一個參數。以泰坦尼克號為例。

原始數據如下:

sns.set(style='darkgrid')
titanic = sns.load_dataset('titanic')
titanic.head()

x, y, hue : names of variables in ``data`` or vector data, optional. Inputs for plotting long-form data. See examples for interpretation.

第一種方式

x: x軸上的條形圖,以x標簽劃分統計個數

y: y軸上的條形圖,以y標簽劃分統計個數

hue: 在x或y標簽劃分的同時,再以hue標簽劃分統計個數

sns.countplot(x="class", data=titanic)

sns.countplot(y="class", data=titanic)

sns.countplot(x="class", hue="who", data=titanic)

第二種方法

x: x軸上的條形圖,直接為series數據

y: y軸上的條形圖,直接為series數據

sns.countplot(x=titanic['class'])

sns.countplot(y=titanic['class'])

data : DataFrame, array, or list of arrays, optional. Dataset for plotting.
If ``x`` and ``y`` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form.

data: DataFrame或array或array列表,用于繪圖的數據集,x或y缺失時,data參數為數據集,同時x或y不可缺少,必須要有其中一個。

sns.countplot(x='class', data=titanic)

order, hue_order : lists of strings, optional.Order to plot the categorical levels in, otherwise the levels are inferred from the data objects.
order, hue_order分別是對x或y的字段排序,hue的字段排序。排序的方式為列表。

sns.countplot(x='class', data=titanic, order=['Third', 'Second', 'First'])

sns.countplot(x='class', hue='who', data=titanic, hue_order=['woman', 'man', 'child'])

orient : "v" | "h", optional
Orientation of the plot (vertical or horizontal). This is usually
inferred from the dtype of the input variables, but can be used to
specify when the "categorical" variable is a numeric or when plotting
wide-form data.
強制定向,v:豎直方向;h:水平方向,具體實例未知。

color : matplotlib color, optional
Color for all of the elements, or seed for a gradient palette.

palette : palette name, list, or dict, optional.Colors to use for the different levels of the ``hue`` variable.
Should be something that can be interpreted by :func:`color_palette`, or a dictionary mapping hue levels to matplotlib colors.

palette:使用不同的調色板

sns.countplot(x="who", data=titanic, palette="Set3")

ax : matplotlib Axes, optional
Axes object to draw the plot onto, otherwise uses the current Axes.

ax用來指定坐標系。

fig, ax = plt.subplots(1, 2, figsize=(10, 5))
sns.countplot(x='class', data=titanic, ax=ax[0])
sns.countplot(y='class', data=titanic, ax=ax[1])

到此這篇關于Python中seaborn庫之countplot的數據可視化使用的文章就介紹到這了,更多相關Python seaborn庫countplot內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • 利用Python進行數據可視化的實例代碼
  • python數據可視化之matplotlib.pyplot基礎以及折線圖
  • 淺談哪個Python庫才最適合做數據可視化
  • python數據可視化plt庫實例詳解
  • 學會Python數據可視化必須嘗試這7個庫
  • python實現股票歷史數據可視化分析案例
  • Python數據可視化之基于pyecharts實現的地理圖表的繪制
  • Python爬蟲實戰之爬取京東商品數據并實實現數據可視化
  • Python數據可視化之用Matplotlib繪制常用圖形
  • Python數據可視化之繪制柱狀圖和條形圖
  • python用pyecharts實現地圖數據可視化
  • python數據可視化 – 利用Bokeh和Bottle.py在網頁上展示你的數據

標簽:楊凌 揚州 牡丹江 六盤水 撫州 南寧 聊城 迪慶

巨人網絡通訊聲明:本文標題《Python中seaborn庫之countplot的數據可視化使用》,本文關鍵詞  Python,中,seaborn,庫之,countplot,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Python中seaborn庫之countplot的數據可視化使用》相關的同類信息!
  • 本頁收集關于Python中seaborn庫之countplot的數據可視化使用的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 女忍者被调教得奶水泛滥小说| 成人网站?免费| 中国xxxb| 欧美╳bbbb| aaa免费视频| 噜噜狠狠色综合久色AⅤ视频| 亚洲欧美精品久久久久久久小说 | 男男gaygays网站中国| 淑芬两腿间又痒痒的用药方法| 国产精品乱码一区二区| 91久久精品无嫩草影院| 恋爱秀场视频全部列表uc安卓| 亚洲精品秘?一区二区三小| 人妻少妇精品无码专区学生| 一二三区AV精品传媒视频| 很很操很很日| 日本中文字幕不卡在线一区二区| 琪琪私人yy480影院| 国产精品44p| 又大又粗又硬又紧又爽| 東京熱大亂交在线AV一区| 最新毛片网| 啊啊啊肉文| 一本无线乱码不卡一二三四| 国产专区青青草原亚洲| 17C一起草在线观看入口官网| 久久97精品久久不卡| jizzjizz护士老师| 下载黄色app| 日韩特级毛片免费观看视频| 草蜢影院在线观看免费观看| 人妻少妇精品无码专区二区伦伦| 国产ts人妖一区二区精品| 同城可约全国空降入口| 国产真人真事一级A片| 玉势开男后菊打屁股| 超级床上人之喜怒哀乐| 偷窥 自由 XXX 视频| 9 1免费版看片| Janpanese日本乱熟50| 骚给你看|