Hello everyone,
I am trying to use matplotlib to plot several bar charts inside a for loop
the problem is that I get the first one, but once I close it I cannot plot
anymore.
I still get the window but no image appear and eventually python crashes.
Here is my code:
[code]
def plot(self):
xCoord = []
yCoord = []
xCoordP = []
yCoordP = []
pylab.Figure()
for i in xrange(self.length-self.length/2):
if i==0 or i%self.size==0:
xCoordP.append(i)
yCoordP.append(self.counts[i])
else:
xCoord.append(i)
yCoord.append(self.counts[i])
bar1, = pylab.subplot(211)
pylab.bar(xCoord,yCoord,color='blue')
pylab.bar(xCoordP,yCoordP,color='red')
xCoord = []
yCoord = []
xCoordP = []
yCoordP = []
for i in xrange(self.length/2,self.length):
if (i+1)%self.size==0:
xCoordP.append(i-self.length/2)
yCoordP.append(self.counts[i])
else:
xCoord.append(i-self.length/2)
yCoord.append(self.counts[i])
bar2, = pylab.subplot(212)
pylab.bar(xCoord,yCoord,color='blue')
pylab.bar(xCoordP,yCoordP,color='red')
pylab.show()
.
.
.
.
for matches,value,n,k in self.lsResults:
self.plot()
[/code]
Thank you in advance for any help.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users