[Tutor] Spyder IDE Anaconda3: Problem with Plt.savefig

Stephen P. Molnar s.molnar at sbcglobal.net
Wed Mar 1 15:20:09 EST 2017


I have written a Python3 program to plot and save UV/VIS spectra from 
the results of an Orca quantum mechanical calculation.

I input the name of the molecule .dat file, without the suffix.

Everything is fine until I get to the point where I want to save the 
figure as name.png using:

figure = name+'.png'
print(figure)
plt.savefig('figure', bbox_inches='tight')

where the print statement verifies the nae of the saved figure. The 
problem is that the saved file is figure.png.

Unfortunately, as I am a neophyte to Python programming I don't what I 
am doing wrong.  It's probably a red-faced forehead slapper of a mistake 
on my part.

A point in the right direction to properly naming the saved figure will 
be muck appreciated.

Thanks in advance.

-- 
Stephen P. Molnar, Ph.D.		Life is a fuzzy set
www.molecular-modeling.net		Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1


More information about the Tutor mailing list