Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

In python how do I maximise the graph before saving it down

I tried this and unfortunately its not working, I can see the graph is maximised but when I save it down still the smaller sized version is saved. Could someone help me with this?

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.randint(1,10,10))
df.plot()
figManager = plt.get_current_fig_manager()
figManager.window.showMaximized()
plt.savefig('gph2.png' )
plt.show()

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You have set the window size, but not the figure size. You can set this by doing something like

newFigure = plt.figure(figsize=(10, 10))

before saving it to the plot

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading