[Python] How to get all legends from a plot?

Discussão em 'Python' iniciado por Stack, Janeiro 31, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Plot with 2 or more legends. How can I "get" all the legends to change (for example) the color and linestyle in the legend?

    handles, labels = ax.get_legend_handles_labels() only gives me the "first" legend, which I added to the plot with plt.legend(). But I want the others legends too, which I added with plt.gca().add_artist(leg2) How can I do that?

    Continue reading...

Compartilhe esta Página