Arshad Mehmood

Search the blog

    Today I Learned

    Label plot lines in matplotlib

    python

    Use plt.legend() to show the labels.

    plt.plot(x_A,y_A,'g--', label="plot A")
    plt.plot(x_B,y_B,'r-o', label="plot A")
    plt.legend()
    plt.show()