0

I wan t to plot 8 lines in a one figure with different color, and labels. however, there are two problems: 1) I found some lines almost the same color, I want to differet color for lines. 2) label is in the middle, I want to put on the upper right, and make the size smaller

My code is following:

    import matplotlib.cm as cm

    colors = iter(cm.rainbow(np.linspace(0, 1, len(lst_year))))
    for i in range(len(lst_year)):
         plt.plot(lst_month, lst_all[i], label='201{i} year'.format(i=i), color=next(colors))
    plt.legend(loc='best')   

and my figure is following:

figure

tktktk0711
  • 1,656
  • 7
  • 32
  • 59
  • Those are two completely unrelated problems. If you have two questions, ask two questions. However you will find a lot of answers for both problems, so you should include in how far they do not help you. – ImportanceOfBeingErnest May 18 '17 at 10:03
  • The legend location is determined by the `loc` parameter. See e.g. [How to put legend out of plot](http://stackoverflow.com/questions/4700614/how-to-put-the-legend-out-of-the-plot/43439132#43439132) – ImportanceOfBeingErnest May 18 '17 at 10:12

0 Answers0