Skip to content

Instantly share code, notes, and snippets.

@aita
Last active December 19, 2015 03:29
Show Gist options
  • Save aita/5890114 to your computer and use it in GitHub Desktop.
Save aita/5890114 to your computer and use it in GitHub Desktop.
numpy&scipyのosxへのインストール

numpy&scipy

scipy superpack

numpy&scipy周りのOSXへのインストールはsuperpackが楽

$ curl -O https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
$ sh install_superpack.sh

ヒストグラム

試しにヒストグラムを表示してみる

ドキュメント:http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html

正規分布のグラフを表示するサンプル

import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import numpy as np

# 身長の疑似データを生成
sample = 10000
mu, sigma = 0, 10
data = np.random.normal(mu, sigma, sample)

# ヒストグラムの描画
n, bins, patches = plt.hist(data, bins=30, normed=True)
# ラインの描画
line = mlab.normpdf(bins, mu, sigma)
plt.plot(bins, line, 'r--', linewidth=1)

plt.show()

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment