Usetex 字体效果
此脚本演示了pdf usetex现在支持pdftex.map中指定的字体效果。

import matplotlibimport matplotlib.pyplot as pltmatplotlib.rc('text', usetex=True)def setfont(font):return r'\font\a %s at 14pt\a ' % fontfor y, font, text in zip(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)plt.ylim(-1, 5)plt.xlim(-0.2, 0.6)plt.setp(plt.gca(), frame_on=False, xticks=(), yticks=())plt.title('Usetex font effects')plt.savefig('usetex_fonteffects.pdf')
脚本的总运行时间:(0分1.262秒)
