[Tutor] Spyder IDE Anaconda3: Problem with Plt.savefig
Stephen P. Molnar
s.molnar at sbcglobal.net
Thu Mar 2 06:12:06 EST 2017
On 03/01/2017 08:32 PM, Alan Gauld via Tutor wrote:
> On 01/03/17 20:20, Stephen P. Molnar wrote:
>> I have written a Python3 program to plot and save UV/VIS spectra from
>> the results of an Orca quantum mechanical calculation.
> Caveat: This forum is for help on the core Python language
> and its standard library. Asking about anything beyond that
> may require a lot more information about the context - for
> example few of us will know anything about UV/VIS spectra
> (even what that means!)
> However, I'll hazard a guess...
>> figure = name+'.png'
>> plt.savefig('figure', bbox_inches='tight')
> Shouldn't the last line use the variable figure
> rather than a literal string '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.
> I'm guessing that's because you are passing the string 'figure'
> instead of the variable.
> But I don;t know anything about your plt object
> or its savefig() method, not even which library
> you are using. Is it matplotlib? Or something else?
That was the problem.
Stephen P. Molnar, Ph.D. Life is a fuzzy set
www.molecular-modeling.net Stochastic and multivariate
More information about the Tutor