save a figure with a precise pixels size with savefig
I added plt.tight_layout() before savefig(), and it solved the trimming issue I had. Maybe it will help yours as well.
I also set the figure size at the begining rcParams['figure.figsize'] = 40, 12(you can set your own width and height)
How can I save a plot in a 750x750 px using savefig?
The only useful parameter is DPI, but I don't understand how can I use it for setting a precise size