File: usetex_fonteffects.py

package info (click to toggle)
matplotlib 1.1.1~rc2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 66,076 kB
  • sloc: python: 90,600; cpp: 69,891; objc: 5,231; ansic: 1,723; makefile: 171; sh: 7
file content (22 lines) | stat: -rw-r--r-- 783 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# This script demonstrates that font effects specified in your pdftex.map
# are now supported in pdf usetex.

import matplotlib
matplotlib.rc('text', usetex=True)
import pylab

def setfont(font):
    return r'\font\a %s at 14pt\a ' % font

for 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)']]):
    pylab.text(0, y, setfont(font) + text)

pylab.ylim(-1, 5)
pylab.xlim(-0.2, 0.6)
pylab.setp(pylab.gca(), frame_on=False, xticks=(), yticks=())
pylab.title('Usetex font effects')
pylab.savefig('usetex_fonteffects.pdf')