def my_legend(ax, pl_list, text, x, y, size, which, plt): l = Legend(ax, pl_list[which - 1:which], (text, ), loc=(x, y)) ltext = l.get_texts() # all the text.Text instance in the legend #plt.setp(ltext, fontsize='medium', linespacing=1) # the legend text fontsize plt.setp(ltext, fontsize=size, linespacing=1) # the legend text fontsize l.draw_frame(False) # don't draw the legend frame ax.add_artist(l)
def my_legend(ax,pl_list, text,x,y,size,which): l = Legend(ax, pl_list[which-1:which], (text,), loc=(x,y)) l.draw_frame(False) # don't draw the legend frame ax.add_artist(l)
pl, = ax.plot(x,y,'r') pl_list.append(pl) y = 10*data[:,3] pl, = ax.plot(x,y,'b') pl_list.append(pl) #plt.xlim([425,450]) #plt.ylim([0,2000]) plt.ylabel(r"Radiation (photons/(s cm$^2$ nm))", fontsize = 12) plt.xlabel(r"Wavelength (nm)", fontsize = 12) from matplotlib.legend import Legend l0 = Legend(ax, pl_list[0:1], ('Solar irradiance',), loc=(0.1,0.85)) #ltext = l0.get_texts() # all the text.Text instance in the legend #plt.setp(ltext, fontsize='small', linespacing=0) # the legend text fontsize l0.draw_frame(False) # don't draw the legend frame ax.add_artist(l0) l0 = Legend(ax, pl_list[1:2], ('Earth shine (multiplied by 10)',), loc=(0.1,0.75)) #ltext = l0.get_texts() # all the text.Text instance in the legend #plt.setp(ltext, fontsize='small', linespacing=0) # the legend text fontsize l0.draw_frame(False) # don't draw the legend frame ax.add_artist(l0) #plt.show() plt.savefig('spectrum_GOME.png')