diff --git a/doc/_static/pgf_fonts.pdf b/doc/_static/pgf_fonts.pdf index 7c5784f6200a..9f9bf0bae67d 100644 Binary files a/doc/_static/pgf_fonts.pdf and b/doc/_static/pgf_fonts.pdf differ diff --git a/doc/_static/pgf_fonts.png b/doc/_static/pgf_fonts.png index 6aa4e360b566..d4ef689f9b33 100644 Binary files a/doc/_static/pgf_fonts.png and b/doc/_static/pgf_fonts.png differ diff --git a/doc/users/pgf.rst b/doc/users/pgf.rst index 6411a9f9c6e3..295e258a6317 100644 --- a/doc/users/pgf.rst +++ b/doc/users/pgf.rst @@ -10,12 +10,28 @@ have full unicode support and can use any fonts installed in the operating system, making use of advanced typographic features of OpenType, AAT and Graphite. Pgf pictures created by ``plt.savefig('figure.pgf')`` can be embedded as raw commands in LaTeX documents. Figures can also be directly -compiled and saved to PDF with ``plt.savefig('figure.pdf')``. +compiled and saved to PDF with ``plt.savefig('figure.pdf')`` by either +switching to the backend -Matplotlib's pgf support requires a working LaTeX_ installation (such as -TeXLive_), preferably including XeLaTeX or LuaLaTeX. If pdftocairo or -ghostscript is installed, figures can optionally be saved to PNG images. -The executables for all applications must be located on your :envvar:`PATH`. +.. code-block:: python + + matplotlib.use('pgf') + +or registering it for handling pdf output + +.. code-block:: python + + from matplotlib.backends.backend_pgf import FigureCanvasPgf + matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf) + +The second method allows you to keep using regular interactive backends and to +save PDF files from the graphical user interface. + +Matplotlib's pgf support requires a recent LaTeX_ installation that includes +the TikZ/PGF packages (such as TeXLive_), preferably with XeLaTeX or LuaLaTeX +installed. If either pdftocairo or ghostscript is present on your system, +figures can optionally be saved to PNG images as well. The executables +for all applications must be located on your :envvar:`PATH`. Rc parameters that control the behavior of the pgf backend: @@ -46,9 +62,10 @@ The fonts used for obtaining the size of text elements or when compiling figures to PDF are usually defined in the matplotlib rc parameters. You can also use the LaTeX default Computer Modern fonts by clearing the lists for ``font.serif``, ``font.sans-serif`` or ``font.monospace``. Please note that -the glyph coverage of these fonts is very limited. For extended unicode support -the `Computer Modern Unicode `_ -fonts "CMU Serif", "CMU Sans Serif" are recommended. +the glyph coverage of these fonts is very limited. If you want to keep the +Computer Modern font face but require extended unicode support, consider +installing the `Computer Modern Unicode `_ +fonts *CMU Serif*, *CMU Sans Serif*, etc. .. literalinclude:: plotting/examples/pgf_fonts.py :end-before: plt.savefig @@ -100,6 +117,11 @@ unicode handling must be configured in the preamble. Possible hangups ================ +* Please note that the TeX packages found in some Linux distributions and + MiKTeX installations are dramatically outdated. Make sure to update your + package catalog and upgrade or install a recent TeX distribution before + reporting problems. + * On Windows, the :envvar:`PATH` environment variable may need to be modified to include the directories containing the latex, dvipng and ghostscript executables. See :ref:`environment-variables` and