From: John H. <jdh...@ac...> - 2004-04-21 19:33:59
|
>>>>> "Eric" == <er...@jo...> writes: Eric> Dear ones, I discovered Matplotlit only yesterday, and it's Eric> great. But I've got one problem. Since I am using the GTK Eric> backend, I have to use the show() function. But I have Eric> hundreds of figures and each to be written into a file. If I Eric> put the show() at the end of my program, the machine just Eric> can't handle it. If I put the show() in a loop, then I have Eric> close the hundreds of picture windows by hand. Is there a Eric> solution to this problem? Yes, you want to use the Agg backend for bulk pure image generation. You don't need to use show and no GUI pops up. You can specify Agg from the command line by doing > python myscript.py -dAgg Or from within your script by doing import matplotlib matplotlib.use('Agg') from matplotlib.matlab import * plot([1,2,3]) savefig('myfile') Agg provides PNG output, which in my opinion is superior to jpeg for line art. These issues are covered in the FAQ, especially "Can I just generate images without having a window popup?" http://matplotlib.sourceforge.net/faq.html You should probably also check out http://matplotlib.sourceforge.net/tutorial.html and http://matplotlib.sourceforge.net/backends.html Good luck! JDH |