如何从matplotlib图例中删除重复的数字?

时间:2018-07-13 14:28:01

标签: python pandas matplotlib graph legend

plot with the legend

有人可以帮助我删除剧情图例行中的重复项吗?通常情况下,它会按照我的意愿出现,但我不知道她的情况如何?

    data_unemp = quandl.get('FRED/SLUEM1524ZSARM')
    plt.style.use("Solarize_Light2")
    plt.plot(data_unemp,lw=2, alpha=0.8, color = 'indigo', label = '_nolegend_')
    plt.scatter(x=data_unemp['Value'].idxmax(), y=unemp_max, c='red', 
        marker='D', s=100, label = 'Maximum Youth Unemployment')
    plt.scatter(x=data_unemp.loc['2001'].index, y=data_unemp.loc['2001'].Value, c='yellow', 
        marker='o', s=100, label = 'Youth Unemployment in 2001')
    plt.ylabel('Rate', fontsize=10)
    plt.xlabel('Timeframe', fontsize=10)
    plt.title('Youth Unemployment Rate in Armenia', fontsize=12)
    plt.legend(loc='lower right', fontsize=10, markerscale=0.6)

0 个答案:

没有答案