matplot library plot with legend code example
Example 1: position of legend matplotlib
plt.legend(loc='upper right')
Example 2: legend matplotlib
import matplotlib.pyplot as plt
#define x and ysin
plt.plot(x,ysin,label='sin(x)')
plt.legend()
plt.show()