Here is the explanation of the code:
- PdfPages() is the package that helps create the PDF document.
- with PdfPages('pdf_reports.pdf') as pdf is a Python context, which takes care of file opening and closing as we save multiple figures into this PDF document. The pdf_reports.pdf file is the file into which figures will be saved.
- plt.figure(figsize=(6, 4)) defines the first figure with a (6, 4) size:
- ax1.scatter(theta, r, c=colors, s=area, cmap='plasma', alpha=0.6) plots a polar plot on axis one.
- ax2.hist(nd, color='c', alpha=0.6, density=1) plots a histogram on axis two.
- ax2.plot(bins, y, '--') plots best fit probability density function for the histogram on the same axis two.
- plt.suptitle('Page One', color='C5', size=20, weight='bold') ...