← How-To Guides How-To How to save a Matplotlib figure Use plt.savefig('out.png'). Set dpi, bbox_inches='tight' as needed. savefig Call before show() if both used. plt.savefig('plot.png', dpi=150, bbox_inches='tight')