5

Anyone know how should i work around with that? I know there is save button which I could do it manually but I am plotting 100+ graph so I hope there will be a way to doing it automatically?

I was using 'TkAgg' backend and I look up for any possible solution around. By using the following at the end of my plot function.

manager = plt.get_current_fig_manager() 
manager.resize(*manager.window.maxsize()) 
plt.savefig(r'C:\Users\310293649\Desktop\PlotFigure\TESTING.png')
plt.show()

EDIT: Tried with this as well but still I was able to plt.show() the figure in the desired way I prefer which is full windows size. But it still automatically save all of my figure in minimize default form.

wm = plt.get_current_fig_manager()
wm.window.state('zoomed')
plt.savefig(r'C:\Users\310293649\Desktop\PlotFigure\TESTING.png')
plt.show()

Below is what I got after plt.show() from above command, Full Windows Mode for my Figure

plt.savefig result that I got: enter image description here

As you can see The code managed to show the plot in max windows size but it still automatically saved the plot with default size So I was wondering if it is possible or is there any solution to save the matplotlib figure in max windows size automatically? OR there is no way I can do that?

Below images is the figure when I done it manually with the save figure button in matplotlib:

enter image description here

EDIT: How to make pylab.savefig() save image for 'maximized' window instead of default size - Most of the answer here refer to showing the figure in full windows form but when it come to saving the max windows automatically(it still save it in the normal size)...you can see the author of the ques have raised up the issue in the comment section of all of the answer but was not answered.

SacreD
  • 363
  • 1
  • 5
  • 16
  • @Dadep I saw that thread as well...The things is from this thread https://stackoverflow.com/a/32428266/8307740 I got the method from here...many ppl upvoted his solution but you can see from the comment, someone else have the same issue as me using this method but was not answered. – SacreD Aug 24 '17 at 16:56
  • 1
    While the question that is linked as potential duplicate is actually the same, none of the answers there solve the problem. They just provide some workarounds or show solutions for other problems outside the scope of the initial question. Therefore and because this question actually asks specifically about the Tk backend, it should definitely stay open. I would nonetheless recommend that this question is [edit]ed as to include in how far the linked question does not help, to make the problem clear to everyone. – ImportanceOfBeingErnest Aug 24 '17 at 17:05
  • @ImportanceOfBeingErnest Thank for the suggestion. I have edited it, hopefully I make the problem clear enough. – SacreD Aug 25 '17 at 09:37
  • I do not know any solution, but I have reopened the question, such that potentially someone can answer it. – ImportanceOfBeingErnest Aug 25 '17 at 09:39

1 Answers1

0

Apparently, this is a bug introduced in Matplotlib 2.0 (January '17).

See here and here.

There seems to be a fairly simple code change to fix this here, but you'll have to apply it yourself since it's not included in any released version yet (it's planned for 2.1.1 2.2).

Community
  • 1
  • 1
OmerB
  • 4,134
  • 3
  • 20
  • 33
  • The changes have been added in `matplotlib==3.0.3`. but the version still has the same problem of minimized animation saves – twitu Aug 03 '19 at 21:37