I just started learning python, so if the code isn't really appropriate, please let me know.
I got a fraction in a plot's legend. But since the position of the label didn't change, it looks quite weird:
My code concerning this plot is the following:
datalist = [(np.loadtxt(filename, skiprows=1), label) for filename,label in list_of_files]
for data, label in datalist:
pylab.errorbar(abs(data[:,0]), abs(data[:,3]), yerr = data[:,4], fmt = 'o', label=r'$\frac{U_1+U_2}{2}$')
legend = pylab.legend(loc = 2, numpoints = 1)
frame = legend.get_frame()
frame.set_facecolor('0.95')
pylab.xlabel(r'I$\,$[$\mathrm{\mu}$A]')
pylab.ylabel('U [V]')
pylab.ylim([0,0.1])
pylab.show()
I used the scope because there will be more values from different files in the plot, I just wanted to fix the label's position before adding the other data.
How can I change the position of the label in the legend?