@@ -10,12 +10,28 @@ have full unicode support and can use any fonts installed in the operating
10
10
system, making use of advanced typographic features of OpenType, AAT and
11
11
Graphite. Pgf pictures created by ``plt.savefig('figure.pgf') `` can be
12
12
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
14
15
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 `.
19
35
20
36
Rc parameters that control the behavior of the pgf backend:
21
37
@@ -46,9 +62,10 @@ The fonts used for obtaining the size of text elements or when compiling
46
62
figures to PDF are usually defined in the matplotlib rc parameters. You can
47
63
also use the LaTeX default Computer Modern fonts by clearing the lists for
48
64
``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.
52
69
53
70
.. literalinclude :: plotting/examples/pgf_fonts.py
54
71
:end-before: plt.savefig
@@ -100,6 +117,11 @@ unicode handling must be configured in the preamble.
100
117
Possible hangups
101
118
================
102
119
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
+
103
125
* On Windows, the :envvar: `PATH ` environment variable may need to be modified
104
126
to include the directories containing the latex, dvipng and ghostscript
105
127
executables. See :ref: `environment-variables ` and
0 commit comments