I have difficulties to understand the legend handling. The more, the basic example from the official matplotlib legend guide
import matplotlib.pyplot as plt
Just remove handles keyword
handles
Use it like that:
import matplotlib.pyplot as plt line_up, = plt.plot([1,2,3], label='Line 2') line_down, = plt.plot([3,2,1], label='Line 1') plt.legend([line_up, line_down])