How to make pylab.savefig() save image for 'maximized' window instead of default size

Python

I am using pylab in matplotlib to create a plot and save the plot to an image file. However, when I save the image using pylab.savefig( image_name ), I find that the SIZE image saved is the same as the image that is shown when I use pylab.show().

As it happens, I have a lot of data in the plot and when I am using pylab.show(), I have to maximize the window before I can see all of the plot correctly, and the xlabel tickers don't superimpose on each other.

Is there anyway that I can programmatically 'maximize' the window before saving the image to file? - at the moment, I am only getting the 'default' window size image, which results in the x axis labels being superimposed on one another.

Answer link : https://codehunter.cc/a/python/how-to-make-pylab-savefig-save-image-for-maximized-window-instead-of-default-size

Posted May 4, 2022, 2:02 AM UTC

10
Loading comments…