saving PdfPages figure before closing

I’m using the approach described the FAQ to save multiple figures to a multi-page PDF:

http://matplotlib.sourceforge.net/faq/howto_faq.html#save-multiple-plots-to-one-pdf-file

The figures are produced at consecutive iterations of my algorithm, and since each iteration takes a long time I’d like to save the PDF containing the current figures at each iteration so that I can take a look. However, it seems that I can only cause the PDF to be written to disk by calling PdfPages.close(), after which I can’t add any more figures. Is there any way I can write a PdfPages object to file, then add more figures and write it to file again later?

\A

Another option would be (if you are using Linux), to create an individual pdf file for each figure (which would allow you to view the figure individually as you progress), and then merge the pdfs together using the “pdfjam” command after you finish your program.

Ben Root

···

On Fri, Aug 12, 2011 at 12:33 PM, Alex Flint <alex.flint@…1003…7…> wrote:

I’m using the approach described the FAQ to save multiple figures to a multi-page PDF:
http://matplotlib.sourceforge.net/faq/howto_faq.html#save-multiple-plots-to-one-pdf-file

The figures are produced at consecutive iterations of my algorithm, and since each iteration takes a long time I’d like to save the PDF containing the current figures at each iteration so that I can take a look. However, it seems that I can only cause the PDF to be written to disk by calling PdfPages.close(), after which I can’t add any more figures. Is there any way I can write a PdfPages object to file, then add more figures and write it to file again later?

\A