%matplotlib inline import matplotlib.pyplot as plt import numpy as np import math plt.plot([1,2,3,4], [1,4,9,16]) plt.show() # 赤い(r)点(o)を表示 plt.plot([1,2,3,4], [1,4,9,16], 'ro') plt.show() # 赤い(r)点(o)を表示 plt.plot([1,2,3,4], [1,4,9,16], 'r-o') plt.show() plt.plot([1,2,3,4], [1,4,9,16], 'ro') # x軸, y軸の範囲を設定 x軸は[0,6], y軸は[0, 20] plt.axis([0, 6, 0, 20]) # グラフにタイトルを付与 plt.title('graph title here') # x軸, y軸に名前を付与 plt.xlabel('x-axis name here') plt.ylabel('y-axis name here') # グラフ中にテキストを表示 plt.text(1, 15, r'text here. $\alpha, \beta, \gamma$') # グリッド線を表示 plt.grid(True) plt.show() # 参考:http://sucrose.hatenablog.com/entry/2013/06/10/001250 import matplotlib.font_manager prop = matplotlib.font_manager.FontProperties(fname=r'C:\Windows\Fonts\meiryo.ttc') plt.title(u'日本語のタイトルを表示', fontproperties=prop) plt.show() x = np.arange(0., 5., 0.2) fx = np.sin(x) plt.plot(x, fx) plt.show() x = np.arange(0., 5., 0.1) fx = np.sin(x) gx = np.cos(x) hx = np.sqrt(x) plt.plot(x, fx, 'r--', x, gx, 'bs', x, hx, 'g^') plt.show()