Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 908435a

Browse files
committed
Shorten PdfPages FAQ entry.
The original wording was inaccurate as both the pdf and pgf backends provide this functionality. I tried fixing that, but duplicating all links to both backends seemed unwieldy; additionally the "narrative" version of the FAQ reads worse (we should just encourage `pp.savefig()` instead of explaining that `plt.savefig()` needs workarounds, and also prefer `with PdfPages(...) as pp:`). Given that the docstring of both classes have examples, I just got rid of most of the FAQ entry instead (see also the next FAQ entries, which also have no code).
1 parent 9307ce8 commit 908435a

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

doc/faq/howto_faq.rst

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,33 +110,10 @@ on individual elements, e.g.::
110110
Save multiple plots to one pdf file
111111
-----------------------------------
112112

113-
Many image file formats can only have one image per file, but some
114-
formats support multi-page files. Currently only the pdf backend has
115-
support for this. To make a multi-page pdf file, first initialize the
116-
file::
117-
118-
from matplotlib.backends.backend_pdf import PdfPages
119-
pp = PdfPages('multipage.pdf')
120-
121-
You can give the :class:`~matplotlib.backends.backend_pdf.PdfPages`
122-
object to :func:`~matplotlib.pyplot.savefig`, but you have to specify
123-
the format::
124-
125-
plt.savefig(pp, format='pdf')
126-
127-
An easier way is to call
128-
:meth:`PdfPages.savefig <matplotlib.backends.backend_pdf.PdfPages.savefig>`::
129-
130-
pp.savefig()
131-
132-
Finally, the multipage pdf object has to be closed::
133-
134-
pp.close()
135-
136-
The same can be done using the pgf backend::
137-
138-
from matplotlib.backends.backend_pgf import PdfPages
139-
113+
Many image file formats can only have one image per file, but some formats
114+
support multi-page files. Currently, Matplotlib only provides multi-page
115+
output to pdf files, using either the pdf or pgf backends, via the
116+
`.backend_pdf.PdfPages` and `.backend_pgf.PdfPages` classes.
140117

141118
.. _howto-auto-adjust:
142119

0 commit comments

Comments
 (0)