Obtenez des légendes et des poignées de l'intrigue dans Matplotlib

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_axes([0.15,0.2,0.7,0.7])
ax.plot([0,1],[0,1],lable = "Test)
#Get handles and labels         
handles, labels = ax.get_legend_handles_labels()
#Handles can be used in a user defined legend!         
HotFlow