Reputation: 357
In matplotlib, matplotlib.pyplot.savefig
saves the current figure. If I have multiple figures as variables in my workspace, e.g. fig1
, fig2
, and fig3
, is it possible to save any of these figures based on their variable name, without first bringing them up as the current figure? E.g., I'd like to do something like:
save('fig2', 'fig2_file.png')
Upvotes: 0
Views: 304
Reputation: 11
You can save individual figures by:
figX.savefig('figX_file.png')
.
Upvotes: 1
Reputation: 56650
You should be able to use Figure.savefig()
. It would look something like this:
fig1.savefig('fig1.png')
fig2.savefig('fig2.png')
fig3.savefig('fig3.png')
Upvotes: 1