![](https://secure.gravatar.com/avatar/3030374b7eb43bb52459984a49fd2ebe.jpg?s=120&d=mm&r=g)
My Markov chain Monte Carlo code calls gplt.plot repeatedly to generate histograms and traces of simulated values. However, rather than re-use the sample gnuplot window, it generates a new frame for each plot it produces, often leaving my screen cluttered with hundreds of plots for more complicated models. I have tried removing the gplt.close() statement in my plotting routine, but then the single window generated does not refresh with each new plot; the initial plot remains displayed until the end of the simulation. I know that if I call plot repeatedly from an interactive python session, subsequent plots are displayed properly in the same frame. Any ideas what may be causing this? Here is a sample of my plotting method, which uses gplt.plot: def time_series(self,data,name,xlab='Time',ylab='Value',suffix='',same_axes=True): 'Internal plotting specification for handling nested arrays' 'If there is only one data array, go ahead and plot it ... ' if len(shape(data))==1 or same_axes: print 'Plotting',name plot(data) 'Plot options' grid('off') xtitle(xlab) ytitle(ylab) 'Save to file' output("%s%s.png" % (name,suffix),'png') #close() else: '... otherwise plot recursively' tdata = swapaxes(data,0,1) for i in range(len(tdata)): self.time_series(tdata[i],name+'_'+str(i),xlab,ylab,suffix)