With the code below, I'd like to create a two page pdf, with both pages in standard portrait (8.5 inches wide and 11 inches tall).
How can I set the plot area of the second page to only use the top half of the page? I tried using the commented out line of code but that just cut the page size in half rather than leaving the page size in tact and halving the plot area.
Thanks!
import numpy as np
import matplotlib
matplotlib.use("PDF")
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import seaborn as sns
sns.set()
xs = np.linspace(-np.pi, np.pi, 40)
ys = np.sin(xs)
with PdfPages('multipage_pdf.pdf') as pdf:
plt.figure(figsize=(8.5, 11))
plt.plot(xs, ys, '-')
plt.title('Page One')
pdf.attach_note('Full page')
pdf.savefig()
plt.close()
plt.figure(figsize=(8.5, 11))
# plt.figure(figsize=(8.5, 5.5))
plt.plot(xs, ys, '-')
plt.title('Page Two')
pdf.attach_note('Want top half of page')
pdf.savefig()
plt.close()
With the help from others, here's the solution (pretty straightforward).