matplotlib.pyplot How to name different lines in the same plot?
import matplotlib.pyplot as pltplt.plot(x_A,y_A,'g--', label="plot A")plt.plot(x_B,y_B,'r-o', label="plot A")plt.legend()plt.show()
You can give each line a label.
plt.plot(x_A,y_A,'g--', label='x_A')
These labels can then be displayed in a legend with
legend()
legend
takes some arguments, see the documentation to see what it can do.