Created
June 24, 2015 14:23
-
-
Save marcelm/c0cbb0b6ee44b471b910 to your computer and use it in GitHub Desktop.
Revisions
-
marcelm created this gist
Jun 24, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ """ Plot multiple figures into a single PDF with matplotlib, using the object-oriented interface. """ from matplotlib.backends.backend_pdf import FigureCanvasPdf, PdfPages from matplotlib.figure import Figure import numpy as np with PdfPages('multi.pdf') as pages: for i in range(10): fig = Figure() ax = fig.gca() ax.plot(np.arange(10), np.random.randn(10)) canvas = FigureCanvasPdf(fig) canvas.print_figure(pages)