MatPlotLib


%matplotlib inline

from scipy.stats import norm
import matplotlib.pyplot as plt
import numpy as np

x = np.arange(-3, 3, 0.001)

plt.plot(x, norm.pdf(x))
plt.show()

#ファイルに保存
plt.plot(x, norm.pdf(x))
plt.plot(x, norm.pdf(x, 1.0, 0.5))
plt.savefig('MyPlot.png', format='png')

#軸の調整
axes = plt.axes()
#軸の範囲
axes.set_xlim([-5, 5])
axes.set_ylim([0, 1.0])
#軸の目盛り
axes.set_xticks([-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5])
axes.set_yticks([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0])
#グリッドの追加
axes.grid()

#ラベル
plt.xlabel('Greebles')
plt.ylabel('Probability')

#凡例 loc=4は右下
plt.legend(['Sneetches', 'Gacks'], loc=4)
#線の種類
#bは青、-はソリッド
#rは赤、:は点線
plt.plot(x, norm.pdf(x), 'b-')
plt.plot(x, norm.pdf(x, 1.0, 0.5), 'r:')


plt.show()