基本的なプログラミングのpython:plt.histに詳細なパラメータでのpythonを使用して

今日の小さな皆がplt.hist詳細なパラメータ、良い基準値上のpythonの使用を共有するため、我々は手助けをしたいです。小扁は、一緒にそれを見るためにフォローアップするために
、次のように:

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)配列または配列の(N)のアレイ

このパラメータは、x軸に対応し、データ配信の各ビン(bin)に指定されています

ビン:整数またはarray_like、オプション

このパラメータは、すなわち、いくつかの棒グラフの合計、ビン(箱)の数を指定します

ノルム:ブール、オプション

Trueの場合、リターンタプルの最初の要素、すなわち、N /(LEN(X) `DBIN)、確率密度を形成するために、正規化カウントであろう

このパラメータは、各棒グラフの割合比密度を、指定し、デフォルト値は1であります

色:色またはなし、オプションの色やarray_like

指定されたカラーバーチャート

私たちは、棒グラフに10,000ポイントの統計的分布に基づい万のデータ、50部の合計の分布を描きます

""" 
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()

ここに画像を挿入説明
これ以上plt.hist詳細なパラメータでの使用のpythonについてのすべての内容全体を共有する小さなシリーズである
公共機関[プログラマ]の数を推奨するすべての人のために良かった最終的に、古いタイマーはスキルを学ぶ多くの学習がありますヒント、面接スキル、職場体験や他の共有、より多くの我々は慎重に、実際のプロジェクトに関する情報をゼロベースの入門情報を用意し、タイミングが毎日Pythonプログラマの技術を説明するために持っているが、いくつかの学習方法と細部への注意を払う必要性を共有しますここに画像を挿入説明

公開された29元の記事 ウォンの賞賛0 ビュー10000 +

おすすめ

転載: blog.csdn.net/chengxun02/article/details/105017749