Last active
December 17, 2019 21:29
-
-
Save milibopp/79e082a0b9b4c24611ea to your computer and use it in GitHub Desktop.
Matplotlib multiple pages in PDF
This file contains 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 characters
import matplotlib.pyplot as plt | |
import numpy as np | |
from matplotlib.backends.backend_pdf import PdfPages | |
with PdfPages('multipage.pdf') as pp: | |
for i in range(0, 10): | |
fig = plt.figure() | |
ax1 = fig.add_subplot(211) | |
ax2 = fig.add_subplot(212) | |
x = np.linspace(0, 10) | |
ax1.plot(x, np.sin(x + i * np.pi / 10)) | |
ax2.plot(x, np.cos(x + i * np.pi / 10)) | |
pp.savefig(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment