I added support to the pdf backend for multipage pdf files. The current
API (which I'm not entirely happy with) is that you create a PdfFile
object, plot your figures, saving each one to the PdfFile object, and
then close the object. The part I'm unhappy about is that because
PdfFile is a file-like object - it has a write method - you can
accidentally save your figure as a png into it and get a broken pdf
file. You have to specify format='pdf' to savefig to avoid this.

Here's an example:

from matplotlib.backends.backend_pdf import PdfFile

pdf = PdfFile('multipage_pdf.pdf')

figure(...)
# build your figure
savefig(pdf, format='pdf')

# repeat for all your figures

pdf.close()


-- 
Jouni K. Seppänen
http://www.iki.fi/jks


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to