'The Legend of the matplotlib graph is not showing in plot

I am trying to put the legend in my precision-recall curve graph but its not showing in the plot. there is one log output which is "No handles with labels found to put in legend." I am unable to get it why its not working help please .. already I saw other related threads but not getting help that's why I posted here

precision1, recall1, thresholds1 = precision_recall_curve(y_true1, y_score1)
plt.ylabel('Precision')
plt.xlabel('Recall')
plt.legend(loc="upper right")
plt.plot(recall1, precision1, label = "Model")


Solution 1:[1]

The plt.legend(loc="upper right") command must be placed after the plt.plot command!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Davide_sd