I have several lines plotted in the same figure and I want name this group of lines according to its content. Over those lines I intended yet to plot the average with the errorbar. But two main problem arise: 1) My legend does not appear as I intend (even trying to plot a extra point out of the range of the figure I can't give them a name - workaround) 2) the plot with the average and errorbars is not superposed. Sometimes it is in front and sometimes it is behind the other curves. What should I do to get it fixed? I could do it in Matlab (same problem for Matlab) But did not find the answer for python. This is the part of the plot of my routine: UYavg = np.nanmean(UYbvall,0) yerr = np.nanstd(UYbvall,0) plt.figure() for i in range(71): plt.plot(LTbvall,UYbvall,'r-') l1 = plt.plot([-2,-1],[1,2],'r-') l2 = plt.plot(LTbvall[3],UYavg,'b*-') plt.errorbar(LTbvall[2],UYavg, yerr = yerr,ecolor='b') plt.xlabel('Tempo (LT)') plt.xlim(0,24) plt.ylabel('Uy (m/s)') plt.title('Vento neutro zonal calculado pelo modelo NWM (BV)') plt.legend((l1,l2),('Perfis COPEX','Media'), loc = 'best') EDIT: the answer must be similar to Multiple lines in a plot or make-custom-legend-in-matplotlib Continue reading...