In matplotlib, matplotlib.pyplot.savefig
saves the current figure. If I have multiple figures as variables in my workspace, eg 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? Eg, I'd like to do something like:
save('fig2', 'fig2_file.png')
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')
You can save individual figures by:
figX.savefig('figX_file.png')
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.