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

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

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

如下所示:

 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

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

bins : integer or array_like, optional

這個參數(shù)指定bin(箱子)的個數(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)

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

color : color or array_like of colors or None, optional

這個指定條狀圖的顏色

我們繪制一個10000個數(shù)據(jù)的分布條狀圖,共50份,以統(tǒng)計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)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

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

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

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

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

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

    python requests post的使用方式

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

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

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

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

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

    Python散點圖與折線圖繪制過程解析

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

    PyTorch加載預(yù)訓練模型實例(pretrained)

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

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

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

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

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

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

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

最新評論