Sometimes, we want to removing white space around a saved image with Python matplotlib
In this article, we’ll look at how to removing white space around a saved image with Python matplotlib
How to removing white space around a saved image with Python matplotlib?
To removing white space around a saved image with Python matplotlib, we call plt.savefig
with the bbox_inches
argument set to 'tight'
.
For instance, we write
plt.savefig('myfile.png', bbox_inches="tight")
to call savefig
to save the flots to myfile.png.
We set bbox_inches
to 'tight'
to reduce padding between the plots.
Conclusion
To removing white space around a saved image with Python matplotlib, we call plt.savefig
with the bbox_inches
argument set to 'tight'
.