import matplotlib import matplotlib.pyplot as plt matplotlib.rc('text', usetex=True)
defsetfont(font): returnr'\font\a %s at 14pt\a ' % font
for y, font, text inzip(range(5), ['ptmr8r', 'ptmri8r', 'ptmro8r', 'ptmr8rn', 'ptmrr8re'], ['Nimbus Roman No9 L ' + x for x in ['', 'Italics (real italics for comparison)', '(slanted)', '(condensed)', '(extended)']]): plt.text(0, y, setfont(font) + text)