I am plotting XRD results in python. I want to use the graphs in an article. My x-axis lable is 2θ. I am using the rc library from matplotlib, which allows me to use latex in the lables, as well as to change the font to serif.
When I do use the normal theta command in latex, i.e. r'$\theta$', I get the theta on my lable, bit it is italicised, as it should be. I want the upright theta however, but the latex command for this, i.e. r'$\uptheta$', does not work. Nor does r'$\mathrm{\theta}$' or similar workarounds.
Is there any way to get an upright theta on my x-axis?
Attached is the relevant code with an image of the graph I get.
import numpy as np
import pandas as pd
from matplotlib import pyplot as pp
%matplotlib inline
from matplotlib import rc
rc("text", usetex=True)
rc("font", family="serif")
sketsverhouding = 4 / 5
vol = 5, 5*sketsverhouding
half = 3, 3*sketsverhouding
derde = 2.3, 2.3*sketsverhouding
data = pd.read_excel(r"C:\Users\pivde\Desktop\Tuks\nagraads\karakterisering\xrd\sifeksp_filament.xlsx", sheet_name = "python_data")
data.head()
def skets(y, etiket):
pp.figure(figsize=half)
pp.plot(data['2theta'], data[y], 'k-')
pp.xlabel(r'2$\theta$ [$^\circ$]')
pp.ylabel('Intensity')
pp.tight_layout()
pp.ylim(0, 15000)
pp.savefig(naam.format(etiket))
naam = 'grafieke/xrd_sifekpsfil_{:03.0f}ldh_pla.svg'
skets('n', 0)
skets('t', 2)