You just have to ask for the legend once, outside of your loop.
For example, in this case I have 4 subplots, with the same lines, and a single legend.
from matplotlib.pyplot import *ficheiros = ['120318.nc', '120319.nc', '120320.nc', '120321.nc']fig = figure()fig.suptitle('concentration profile analysis')for a in range(len(ficheiros)): # dados is here defined level = dados.variables['level'][:] ax = fig.add_subplot(2,2,a+1) xticks(range(8), ['0h','3h','6h','9h','12h','15h','18h','21h']) ax.set_xlabel('time (hours)') ax.set_ylabel('CONC ($\mu g. m^{-3}$)') for index in range(len(level)): conc = dados.variables['CONC'][4:12,index] * 1e9 ax.plot(conc,label=str(level[index])+'m') dados.close()ax.legend(bbox_to_anchor=(1.05, 0), loc='lower left', borderaxespad=0.) # it will place the legend on the outer right-hand side of the last axesshow()