`plt.savefig()` saves figures directly to disk in raster formats (PNG, JPG) or infinitely scalable vector formats (PDF, SVG, EPS) suitable for academic journals and LaTeX theses.
Exporting a high-res master render from Photoshop or Adobe Illustrator.
Automatically calculates the exact bounding box enclosing all labels, titles, and legends, cropping excess white border margins.
plt.savefig('plot.png', dpi=300, bbox_inches='tight')Renders the figure background transparent (alpha=0), allowing the chart to blend seamlessly into dark mode slides or web apps.
plt.savefig('chart.png', transparent=True)Avoid the top errors and bad plotting practices that trip up new Python developers
Switch from abstract numbers to relatable Cricket, Cinema & Business charts
Write Matplotlib code to solve the objective and see your live plot render
Print the correct high-res savefig command using `print('plt.savefig("chart.png", dpi=300, bbox_inches="tight")')`.
✓ savefig✓ dpi=300Test your understanding to unlock the lesson completion badge