Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > a44f8c7e78ee9c5838c1fb080c9e7630 > files > 1450

python-matplotlib-doc-1.1.1-1mdv2010.1.noarch.rpm

.. _pylab_examples-usetex_fonteffects:

pylab_examples example code: usetex_fonteffects.py
==================================================



.. plot:: /home/mandrake/rpm/BUILD/matplotlib-1.1.1/doc/mpl_examples/pylab_examples/usetex_fonteffects.py

::

    # 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')
    

Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`)