Created
June 11, 2019 20:33
-
-
Save gavincangan/46ba3f2d9097c431b1043e97fb2baece to your computer and use it in GitHub Desktop.
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
from matplotlib.backends.backend_pdf import PdfPages | |
def multipage(filename, figs=None, dpi=200): | |
pp = PdfPages(filename) | |
if figs is None: | |
figs = [plt.figure(n) for n in plt.get_fignums()] | |
for fig in figs: | |
try: | |
fig.savefig(pp, format='pdf') | |
except: | |
print('At least one of the figures could not be saved to PDF') | |
pp.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment