|
4 | 4 | ==================
|
5 | 5 |
|
6 | 6 | This script demonstrates that font effects specified in your pdftex.map
|
7 |
| -are now supported in pdf usetex. |
| 7 | +are now supported in usetex mode. |
8 | 8 | """
|
9 | 9 |
|
10 | 10 | import matplotlib.pyplot as plt
|
11 | 11 |
|
12 | 12 |
|
13 | 13 | def setfont(font):
|
14 |
| - return r'\font\a %s at 14pt\a ' % font |
| 14 | + return rf'\font\a {font} at 14pt\a ' |
15 | 15 |
|
16 | 16 |
|
| 17 | +fig = plt.figure() |
17 | 18 | for y, font, text in zip(range(5),
|
18 | 19 | ['ptmr8r', 'ptmri8r', 'ptmro8r',
|
19 | 20 | 'ptmr8rn', 'ptmrr8re'],
|
20 | 21 | ['Nimbus Roman No9 L ' + x for x in
|
21 | 22 | ['', 'Italics (real italics for comparison)',
|
22 | 23 | '(slanted)', '(condensed)', '(extended)']]):
|
23 |
| - plt.text(0, y, setfont(font) + text, usetex=True) |
| 24 | + fig.text(.1, 1 - (y + 1) / 6, setfont(font) + text, usetex=True) |
24 | 25 |
|
25 |
| -plt.ylim(-1, 5) |
26 |
| -plt.xlim(-0.2, 0.6) |
27 |
| -plt.setp(plt.gca(), frame_on=False, xticks=(), yticks=()) |
28 |
| -plt.title('Usetex font effects') |
29 |
| -plt.savefig('usetex_fonteffects.pdf') |
| 26 | +fig.suptitle('Usetex font effects') |
| 27 | +# Would also work if saving to pdf. |
| 28 | +plt.show() |
0 commit comments