← Back to team overview

yade-users team mailing list archive

save python figure

 

Hi,

I want to save in a figure, without showing it, the output from
utils.plotDirections(), say just before the triaxial phase. How to do it in
python? I checked in utils.py code and there a pylab.show() a the end of the
function plotDirections. But how do I save the figure and avoid to display
it? I know I could stop the simulation, display it and then restart running
but I want to do it automatically so saving the figure would be the better.
I tried something like

pylab.gcf().savefig('/home/chia/Desktop/directions.png')

but with no success as the code always just displays it. Any suggestions?

cheers, Chiara

Follow ups