I am trying to do EDA with the Kaggle dataset Is there a way to add the legend in here in accordance to the 3 vertical lines like this with each line type denoting the value?
Also, how to add more values in x axis of all three graphs? like make it interval of 5 or 2 years apart?
Thanks
CodePudding user response:
Give the axvlines a "label" value, then call plt.legend
after plotting it.
Example:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[1,2,3],label="Test")
plt.axvline(x=0.22058956, label="Test2", color="red")
plt.legend()