8000 backend_pgf: clarifications and fixes in documentation · dmcdougall/matplotlib@f628e72 · GitHub
[go: up one dir, main page]

Skip to content

Commit f628e72

Browse files
author
pwuertz
committed
backend_pgf: clarifications and fixes in documentation
1 parent 8cefc3f commit f628e72

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

doc/_static/pgf_fonts.pdf

17.1 KB
Binary file not shown.

doc/_static/pgf_fonts.png

559 Bytes
Loading

doc/users/pgf.rst

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,28 @@ have full unicode support and can use any fonts installed in the operating
1010
system, making use of advanced typographic features of OpenType, AAT and
1111
Graphite. Pgf pictures created by ``plt.savefig('figure.pgf')`` can be
1212
embedded as raw commands in LaTeX documents. Figures can also be directly
13-
compiled and saved to PDF with ``plt.savefig('figure.pdf')``.
13+
compiled and saved to PDF with ``plt.savefig('figure.pdf')`` by either
14+
switching to the backend
1415

15-
Matplotlib's pgf support requires a working LaTeX_ installation (such as
16-
TeXLive_), preferably including XeLaTeX or LuaLaTeX. If pdftocairo or
17-
ghostscript is installed, figures can optionally be saved to PNG images.
18-
The executables for all applications must be located on your :envvar:`PATH`.
16+
.. code-block:: python
17+
18+
matplotlib.use('pgf')
19+
20+
or registering it for handling pdf output
21+
22+
.. code-block:: python
23+
24+
from matplotlib.backends.backend_pgf import FigureCanvasPgf
25+
matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf)
26+
27+
The second method allows you to keep using regular interactive backends and to
28+
save PDF files from the graphical user interface.
29+
30+
Matplotlib's pgf support requires a recent LaTeX_ installation that includes
31+
the TikZ/PGF packages (such as TeXLive_), preferably with XeLaTeX or LuaLaTeX
32+
installed. If either pdftocairo or ghostscript is present on your system,
33+
figures can optionally be saved to PNG images as well. The executables
34+
for all applications must be located on your :envvar:`PATH`.
1935

2036
Rc parameters that control the behavior of the pgf backend:
2137

@@ -46,9 +62,10 @@ The fonts used for obtaining the size of text elements or when compiling
4662
figures to PDF are usually defined in the matplotlib rc parameters. You can
4763
also use the LaTeX default Computer Modern fonts by clearing the lists for
4864
``font.serif``, ``font.sans-serif`` or ``font.monospace``. Please note that
49-
the glyph coverage of these fonts is very limited. For extended unicode support
50-
the `Computer Modern Unicode <http://sourceforge.net/projects/cm-unicode/>`_
51-
fonts "CMU Serif", "CMU Sans Serif" are recommended.
65+
the glyph coverage of these fonts is very limited. If you want to keep the
66+
Computer Modern font face but require extended unicode support, consider
67+
installing the `Computer Modern Unicode <http://sourceforge.net/projects/cm-unicode/>`_
68+
fonts *CMU Serif*, *CMU Sans Serif*, etc.
5269

5370
.. literalinclude:: plotting/examples/pgf_fonts.py
5471
:end-before: plt.savefig
@@ -100,6 +117,11 @@ unicode handling must be configured in the preamble.
100117
Possible hangups
101118
================
102119

120+
* Please note that the TeX packages found in some Linux distributions and
121+
MiKTeX installations are dramatically outdated. Make sure to update your
122+
package catalog and upgrade or install a recent TeX distribution before
123+
reporting problems.
124+
103125
* On Windows, the :envvar:`PATH` environment variable may need to be modified
104126
to include the directories containing the latex, dvipng and ghostscript
105127
executables. See :ref:`environment-variables` and

0 commit comments

Comments
 (0)
0