sheldon cooper 2.0のブログ

sheldon cooper 2.0のブログ

ブログの説明を入力します。

Amebaでブログを始めよう!

handle_list, label_list = [], []
handles, labels = plt.gca().get_legend_handles_labels()
handle_list.append(handles[1])
handle_list.append(handles[0])
label_list.append(labels[1])
label_list.append(labels[0])
plt.legend(handle_list, label_list)

Ref)
http://stackoverflow.com/questions/13588920/stop-matplotlib-repeating-labels-in-legend