Clarence Lee
Clarence Lee

Reputation: 15

plt.show() and plt.savefig() how to save plt.show() image without showing using plt.show()?

This question is a continuation for this question below

plt.show and plt.savefig give different result

By putting plt.show() infront of plt.savefig(), the plot and save image would be the same.

Is there a way to save the figure which is after plt.show() but not using the plt.show() function due to the blocking it have?

Tried putting block=false but it wont save the same as the plt.show()

Upvotes: 0

Views: 266

Answers (2)

EggSci
EggSci

Reputation: 5

The plot should come up in a separate tab (at least it does on Spyder). There should be a save button on this here and you can easily save it from there. It should allow multiple plots (if you have them) to be generated and then saved.

The save button is in the top right hand corner.

enter image description here

Upvotes: 0

James
James

Reputation: 36608

Add plt.ion(), this turns on interactive mode for matplotlib. The image will open and the code keeps running.

Upvotes: 1

Related Questions