棒グラフ
    Top > Python > 描画 > グラフ
    matplotlib.pyplot.bar
    ax.bar(left, height, width=width, bottom=bottom, data=data,**kwargs) leftとheightは同じ長さの1d-array, もしくはリストやタプルなど.
    matplotlib.pyplot.hist
    ax.hist(x, bins=bins, range=range, normed=normed, weights=weights, cumulative=cumulative, bottom=bottom, histtype=histtype, align=align, orientation=orientation, rwidth=rwidth, log=log, color=color, label=label, stacked=stacked, data=data, **kwargs) 基本形はplt.hist(x). この関数はきれいな図が簡単に描けるが,挙動がちょっとよくわからないことがある.
    ヒストグラムの確率表示
    plt.hist()でnormed=Trueとすると正規化され,バーの面積の和が1.0になる. またこれとは別に,母集団のうちどれだけの割合の要素が各レンジに存在するかを表すには,weightsを利用する. 母数をN(=len(data)) とすると,weightsは「長さがNで値が全て1/Nの1d-array」になる.各標本に1/Nの重みづけをするということ. なおplt.bar()にはweightsはないが,そもそも必要ない. 上のように予めheightをnp.sum(height)で割っておけばよい. 正規化する際には底辺を考慮してheightの値を変える.