User Tools

Site Tools


python:plt
def legend_without_duplicate_labels(ax):
    handles, labels = ax.get_legend_handles_labels()
    unique = [(h, l) for i, (h, l) in enumerate(zip(handles, labels)) if l not in labels[:i]]
    ax.legend(*zip(*unique))
python/plt.txt · Last modified: 2023/01/29 20:53 by a.boev

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki