for q in range(1, 10):
    s_A_approx = np.random.randint(0, 100, 100)
matplotlib.pylab.plot(s_A_approx, marker='.', linestyle='None', label=str(q))
matplotlib.pylab.legend(loc='upper left')
Dynamically add legends to matplotlib plots in python