Skip to content

Instantly share code, notes, and snippets.

@mkacky
Created July 13, 2013 16:37
Show Gist options
  • Save mkacky/5991271 to your computer and use it in GitHub Desktop.
Save mkacky/5991271 to your computer and use it in GitHub Desktop.
sample of hist
#! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
## ファイルからデータを読み込み
data = np.loadtxt("hist.dat")
## ビンの幅
width = 0.5
## 横軸の最大値
max = 10
## binsにはビンの数を表すスカラーを代入,
y, ind, pacthes = plt.hist(data, bins = 2 * max / width, range = (-max, max))
# y : 縦軸の値(分布)
# ind : 横軸の値(度数の始点)
# patches : グラフ描画用のなにか
# 表示
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment