This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
python:matplotlib:基本的な使い方 [2018/01/20 22:50] koudai |
python:matplotlib:基本的な使い方 [2018/01/20 23:06] koudai |
||
---|---|---|---|
Line 41: | Line 41: | ||
plt.plot(x, y) | plt.plot(x, y) | ||
- | plt.savefig(" | + | plt.savefig(" |
</ | </ | ||
Line 73: | Line 73: | ||
x = np.arange(-np.pi, | x = np.arange(-np.pi, | ||
y = np.sin(x) | y = np.sin(x) | ||
- | plt.title(" | + | plt.title(" |
- | plt.xlabel(" | + | plt.xlabel(" |
plt.ylabel(" | plt.ylabel(" | ||
Line 88: | Line 88: | ||
複数のグラフを同時にプロットしたい場合を扱います。 | 複数のグラフを同時にプロットしたい場合を扱います。 | ||
例えばsin関数とcos関数を同時にプロットしたい場合は、次のようにします。 | 例えばsin関数とcos関数を同時にプロットしたい場合は、次のようにします。 | ||
+ | どっちのグラフがどっちの関数かわからなくなるので凡例(legend)をつけます。 | ||
<file python sin.py> | <file python sin.py> |