From: John H. <jdh...@ac...> - 2004-09-01 19:26:14
|
>>>>> "Faust," == Faust, Markus <Mar...@sp...> writes: Faust,> Hi, I'm trying to plot a series of graphs Faust,> #!/usr/bin/python # -*- coding: UTF-8 -*- Faust,> # Dr. Markus Faust # Faust,> markus.faust@+>>no-spam<<+space.eads.net Faust,> from numarray import * from matplotlib.matlab import * Faust,> x = arange(400.)*0.01+1. y = x**2*exp(x) Faust,> for i in range(3): clf() Figure(figsize=(11.0,7.5)) Faust,> lines=semilogy(x, abs(y), 'r-') set(lines, 'linewidth', Faust,> 2.0) title('test') xlabel('x') ylabel('y') grid('on') Faust,> fname = 'test' + str(i) +'.png' savefig(fname, dpi=250) Faust,> show() Faust,> With matplotlib-0.61.0-numarray0.9-win32-py2.3 this works Faust,> as it should. One plot windows occurs, I click it away Faust,> and the next occurs. Faust,> But with matplotlib-0.62.4.win32-py2.3.exe the program Faust,> behaves strange. The first windows occurs and I can click Faust,> it away but the next windows can not be controlled Faust,> anymore. Is that anticipated? Faust,> I'm working on a Windows XP Prof. PC with Python 2.3.4 and Faust,> numarray 0.9. show should be called only once per script -- see http://matplotlib.sourceforge.net/faq.html#SLOW. Try replacing the call to Figure(figsize=(11.0,7.5)) with figure(i+1, figsize=(11.0,7.5)) Figure is an API call and figure is a matplotlib interface call. It is dangerous and unpredictable to mix the 2. Other comments: you don't need to import numarray if your matplotlib numerix rc setting is 'numarray' the matplotlib.matlab import will do this for you I've attached a modified (untested script below). I'm on the road en route to the SciPy conference, so will be mostly out of touch for a few days. Hope this helps, JDH from matplotlib.matlab import * x = arange(400.)*0.01+1. y = x**2*exp(x) for i in range(3): clf() figure(i+1, figsize=(11.0,7.5)) lines=semilogy(x, abs(y), 'r-') set(lines, 'linewidth', 2.0) title('test') xlabel('x') ylabel('y') grid('on') fname = 'test' + str(i) +'.png' savefig(fname, dpi=250) show() |