Matplotlib
プロット例
折れ線グラフ
>>> import matplotlib.pyplot as plt>>> import numpy as np>>> a = np.linspace(0,10,100)>>> b = np.exp(-a)>>> plt.plot(a,b)>>> plt.show()
ヒストグラム
>>> import matplotlib.pyplot as plt>>> from numpy.random import normal,rand>>> x = normal(size=200)>>> plt.hist(x,bins=30)>>> plt.show()
散布図
>>> import matplotlib.pyplot as plt>>> from numpy.random import rand>>> a = rand(100)>>> b = rand(100)>>> plt.scatter(a,b)>>> plt.show()
3Dグラフ
>>> from matplotlib import cm>>> from mpl_toolkits.mplot3d import Axes3D>>> import matplotlib.pyplot as plt>>> import numpy as np>>> fig = plt.figure()>>> ax = fig.gca(projection='3d')>>> X = np.arange(-5, 5, 0.25)>>> Y = np.arange(-5, 5, 0.25)>>> X, Y = np.meshgrid(X, Y)>>> R = np.sqrt(X**2 + Y**2)>>> Z = np.sin(R)>>> surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm)>>> plt.show()