matplotlib to multipage-pdf

Seulgi Kim·2023년 4월 28일
0

python

목록 보기
2/2
from matplotlib.backends.backend_pdf import PdfPages

PdfPage = PdfPages('../plots/test.pdf')

fig, ax = plt.subplots(1,1)
ax.plot(x1, y1)
PdfPage.savefig(fig)
plt.close()

fig, ax = plt.subplots(1,1)
ax.plot(x2, y2)
PdfPage.savefig(fig)
plt.close()

PdfPage.close()

matplotlib으로 여러 페이지의 pdf 파일을 만드는 방법.
savefig()를 기준으로 페이지가 나뉜다.

0개의 댓글