On 02/19/2012 07:08 PM, surfcast23 wrote: > > Hi I wrote the following script, but it hangs right after plt.show(). I would > really appreciate it if someone could take a look and let me know where I'm > messing up. Thanks in advance
That's what show() does in a script--it displays the plot and blocks execution until you close the window. It can be more complicated than that depending on the version of mpl you are running. So, what version are you running, and what is the behavior you are trying to achieve? An animation? Eric > > from numpy import * > import matplotlib.pyplot as plt > > #H=p^2/2-cosq > #p=dp=-dH/dq > #q=dq=dH/dp > > t = 0 > h = 0.5 > pfa = [] #Create arrays that will hold pf,qf values > qfa = [] > > while t< 10: > q = 1+t > p = -sin(q+t) > > p1 = p > q1 = q > p2 = p + h/2*q1 > q2 = q + h/2*p1 > p3 = p+ h/2*q2 > q3 = q+ h/2*p2 > p4 = p+ h/2*q3 > q4 = q+ h/2*p4 > pf = (p +(h/6)*(p1+2*p2+3*p3+p4)) > qf = (q +(h/6)*(q1+2*q2+3*q3+q4)) > #pf = log10(pf) #Convert to log scale > #qf = log10(qf) > pfa.append(pf) #append arrays > qfa.append(qf) > t += h #increase time step > > print("test") > plt.plot(pfa,qfa) > print("test1") > plt.show() > print("tes2t") > > > > ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users