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

Time:08-08

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()

CodePudding user response:

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

CodePudding user response:

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.

enter image description here

The save button is in the top right hand corner.

  • Related