On 06/15/2011 12:35 PM, jonasr wrote: > > hello, > > a lot of matplotlib examples i saw included the usage of line, i.e. > > from pylab import * > import time > > ion() > > tstart = time.time() # for profiling > x = arange(0,2*pi,0.01) # x-array > line, = plot(x,sin(x)) > for i in arange(1,200): > line.set_ydata(sin(x+i/10.0)) # update the data > draw() # redraw the canvas > > print 'FPS:' , 200/(time.time()-tstart) > > can anybody explain to me whats the difference between line and line, ? >
plot returns a list of lines, and line, = plot(...) returns the first one (which in your case is the only one) It is the same as line = plot(...)[0] It is a special case of Python's sequence unpacking, e.g.: a, b, c = [1, 2, 3] Eric ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users