From: John H. <jdh...@ac...> - 2004-02-02 14:57:54
|
>>>>> "Engelsma," == Engelsma, Dave <D.E...@La...> writes: Hi David, please post questions directly to the matplotlib-users list. Engelsma> Hello -- Is it possible to save figures (I'm using the Engelsma> .eps feature) without having to show the plots/charts Engelsma> on the user's screen? I'd like to be able to save the Engelsma> figures to disk without showing them on the Engelsma> screen. Currently, it seems that the figures will not Engelsma> save to disk, unless I issue the show() command after Engelsma> the savefig. I'd like to eliminate having to call Engelsma> show(). From your email, it sounds like you are using the GTK backend and saving figures with the ps backend. If you just want to save the figures as PS and not show them to the screen, use the ps backend directly as described on http://matplotlib.sourceforge.net/backends.html > python myscript.py -dPS or import matplotlib matplotlib.use('PS') from matplotlib.matlab import * t = arange(0.0, 3.0, 0.01) for i in range(1,10): figure(1) s = sin(2*pi*i*t) plot(t,s) savefig('plot%02d' % i) close(1) In either case, there is no need to call 'show'. If you want to make multiple figures, you need to clear them between each save, as I did here by closing the figure. If you really want to use the GTK backend to make PS figures without showing the figure, there are some things that will enable this, but I don't see any reasons to go this route. Let me know. JDH |