Matplotlib
How to Save a Figure in Matplotlib with savefig
Save Matplotlib plots to PNG, SVG, PDF, or JPEG with fig.savefig, and control resolution, cropping, background color, and multi-page PDFs.
Python plotting and visualization demystified
Save Matplotlib plots to PNG, SVG, PDF, or JPEG with fig.savefig, and control resolution, cropping, background color, and multi-page PDFs.