Hello, I started using pylab-matplotlib some weeks ago. And it is really good.
I'm working now on windows (TkAgg). I have written a small app that reads a file and plot it. User can press a key to read another file, and plot it over. The problem is that the I have to resize the plot window to see the new plotted line. Here is the code: import sys import os import tkFileDialog import pylab pylab.hold(1) path='E:\\Nima' def keyp(event): global path if event.key.lower()=='o': fin = tkFileDialog.askopenfilename(initialdir=path) path=os.path.split(fin)[0] plot2(fin) def plot2(fin): global myplot f=file(fin, 'r') lines=f.readlines() f.close() X=[] Y=[] for line in lines[1:]: line=line.replace(',', '.') X.append(float(line.split('\t')[2])) Y.append(float(line.split('\t')[5])) myplot.plot(X, Y) myplot.grid() myplot.draw() if __name__=='__main__': myplot=pylab.subplot(111) kid=pylab.connect('key_press_event', keyp) pylab.xlabel('Area [A2/molecule]') pylab.ylabel('SP [mN/m]') fin = tkFileDialog.askopenfilename(initialdir=path) path=os.path.split(fin)[0] pylab.show() plot2(fin) Thanks in advance for your help. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users