欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

關(guān)于python中plt.hist參數(shù)的使用詳解

 更新時(shí)間:2019年11月28日 14:54:25   作者:我是賣報(bào)的小行家啦啦啦  
今天小編就為大家分享一篇關(guān)于python中plt.hist參數(shù)的使用詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧

如下所示:

 matplotlib.pyplot.hist( 
  x, bins=10, range=None, normed=False,  
  weights=None, cumulative=False, bottom=None,  
  histtype=u'bar', align=u'mid', orientation=u'vertical',  
  rwidth=None, log=False, color=None, label=None, stacked=False,  
  hold=None, **kwargs) 

x : (n,) array or sequence of (n,) arrays

這個(gè)參數(shù)是指定每個(gè)bin(箱子)分布的數(shù)據(jù),對(duì)應(yīng)x軸

bins : integer or array_like, optional

這個(gè)參數(shù)指定bin(箱子)的個(gè)數(shù),也就是總共有幾條條狀圖

normed : boolean, optional

If True, the first element of the return tuple will be the counts normalized to form a probability density, i.e.,n/(len(x)`dbin)

這個(gè)參數(shù)指定密度,也就是每個(gè)條狀圖的占比例比,默認(rèn)為1

color : color or array_like of colors or None, optional

這個(gè)指定條狀圖的顏色

我們繪制一個(gè)10000個(gè)數(shù)據(jù)的分布條狀圖,共50份,以統(tǒng)計(jì)10000分的分布情況

  """ 
  Demo of the histogram (hist) function with a few features. 
   
  In addition to the basic histogram, this demo shows a few optional features: 
   
    * Setting the number of data bins 
    * The ``normed`` flag, which normalizes bin heights so that the integral of 
     the histogram is 1. The resulting histogram is a probability density. 
    * Setting the face color of the bars 
    * Setting the opacity (alpha value). 
   
  """ 
  import numpy as np 
  import matplotlib.mlab as mlab 
  import matplotlib.pyplot as plt 
   
   
  # example data 
  mu = 100 # mean of distribution 
  sigma = 15 # standard deviation of distribution 
  x = mu + sigma * np.random.randn(10000) 
   
  num_bins = 50 
  # the histogram of the data 
  n, bins, patches = plt.hist(x, num_bins, normed=1, facecolor='blue', alpha=0.5) 
  # add a 'best fit' line 
  y = mlab.normpdf(bins, mu, sigma) 
  plt.plot(bins, y, 'r--') 
  plt.xlabel('Smarts') 
  plt.ylabel('Probability') 
  plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$') 
   
  # Tweak spacing to prevent clipping of ylabel 
  plt.subplots_adjust(left=0.15) 
  plt.show() 

以上這篇關(guān)于python中plt.hist參數(shù)的使用詳解就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Python3直接爬取圖片URL并保存示例

    Python3直接爬取圖片URL并保存示例

    今天小編就為大家分享一篇Python3直接爬取圖片URL并保存示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-12-12
  • Laravel+Dingo/Api 自定義響應(yīng)的實(shí)現(xiàn)

    Laravel+Dingo/Api 自定義響應(yīng)的實(shí)現(xiàn)

    這篇文章主要介紹了Laravel+Dingo/Api 自定義響應(yīng)的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-02-02
  • python requests post的使用方式

    python requests post的使用方式

    這篇文章主要介紹了python requests post的使用方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • Python 實(shí)現(xiàn)數(shù)組相減示例

    Python 實(shí)現(xiàn)數(shù)組相減示例

    今天小編就為大家分享一篇Python 實(shí)現(xiàn)數(shù)組相減示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-12-12
  • django中F表達(dá)式和Q函數(shù)應(yīng)用與原理詳解

    django中F表達(dá)式和Q函數(shù)應(yīng)用與原理詳解

    F對(duì)象查詢與Q對(duì)象查詢,剛看到大家一定會(huì)感到很陌生,其實(shí)它們也是 Django 提供的查詢方法,而且非常的簡單的高效,下面這篇文章主要給大家介紹了關(guān)于django中F表達(dá)式和Q函數(shù)應(yīng)用與原理的相關(guān)資料,需要的朋友可以參考下
    2023-05-05
  • Python散點(diǎn)圖與折線圖繪制過程解析

    Python散點(diǎn)圖與折線圖繪制過程解析

    這篇文章主要介紹了Python散點(diǎn)圖與折線圖繪制過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-11-11
  • PyTorch加載預(yù)訓(xùn)練模型實(shí)例(pretrained)

    PyTorch加載預(yù)訓(xùn)練模型實(shí)例(pretrained)

    今天小編就為大家分享一篇PyTorch加載預(yù)訓(xùn)練模型實(shí)例(pretrained),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-01-01
  • Python3如何將源目錄中的圖片用MD5命名并可以設(shè)定目標(biāo)目錄

    Python3如何將源目錄中的圖片用MD5命名并可以設(shè)定目標(biāo)目錄

    這篇文章主要介紹了Python3如何將源目錄中的圖片用MD5命名并可以設(shè)定目標(biāo)目錄,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-02-02
  • 4行Python代碼生成圖像驗(yàn)證碼(2種)

    4行Python代碼生成圖像驗(yàn)證碼(2種)

    這篇文章主要介紹了4行Python代碼生成圖像驗(yàn)證碼(2種),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-04-04
  • 基于Python實(shí)現(xiàn)一個(gè)簡易的數(shù)據(jù)管理系統(tǒng)

    基于Python實(shí)現(xiàn)一個(gè)簡易的數(shù)據(jù)管理系統(tǒng)

    為了方便的實(shí)現(xiàn)記錄數(shù)據(jù)、修改數(shù)據(jù)沒有精力去做一個(gè)完整的系統(tǒng)去管理數(shù)據(jù)。因此,在python的控制臺(tái)直接實(shí)現(xiàn)一個(gè)簡易的數(shù)據(jù)管理系統(tǒng),包括數(shù)據(jù)的增刪改查等等。感興趣的可以跟隨小編一起學(xué)習(xí)一下
    2021-12-12

最新評(píng)論