matplotlibでLabelを付ける。

Macpythonのライブラリーmatplotlibを使ってグラフを書くとデフォルトではラベルを付けてくれません。(Ubuntuだと付いたような?うろ覚え、、、)
グラフにラベルを付けるには plotを使うさいに、labelに引数を渡し、legend()を実行してやる必要があります。

import matplotlib.pyplot as plt

x = arange(0, 100, 0.1)

plt.plot(x, sin(x), label = 'w=1')
plt.plot(x, sin(2*x), label = 'w = 2')
plt.legend()
plt.show()