pylab.plot(x, y1, '-b', label='sine')
pylab.plot(x, y2, '-r', label='cosine')
pylab.legend(loc='upper left')
pylab.ylim(-1.5, 2.0)
pylab.show()
Adding a legend to PyPlot in Matplotlib in the most simple manner possible