arrays and plotting lines plt plot( , #initial plot to create the lines object def next_frame( ) (xmslines[ set_ydata(yreturn lines ani funcanimation(plt gcf()next_frameframes=s_valuesinterval= ani save('movie mp ',fps= plt show(most of the lines are identical to the examples abovebut there are some key differences we define function next_frame that contains all the code that updates the plot for each frameand returns an updated line object the argument to this function should be whatever argument that is changed for each frame (in our casesafter defining this functionwe use it to create funcanimation object in the next lineani funcanimation(plt gcf()next_frameframes=s_valuesinterval= this function call returns an object of type funcanimation the first argument is simply the current figure object we are working with (gcf being short for get current figure)the next is the function we just defined to update the framesthe third is the array of -values used to create the plotsand the last argument is the interval between frames in milliseconds numerous other optional arguments to the function can be used to tune the animation we refer to the matplotlib documentation for the details after the object is createdwe call the save method of the funcanimation class to create movie file, or the usual show(to play it directly on the screen more useful array operations at the start of this we introduced the most essential operations needed to use arrays in computations and for plottingbut numpy arrays can do much more here we introduce few additional operations that are convenient to know about when working with arrays firstwe often need to make an array of the same size as another array this can be done in several waysfor instanceusing the zeros function introduced aboveimport numpy as np np linspace( , , technicallywhat happens here is that we call the constructor of the class funcanimation to create an object of this class we will cover classes and constructors in detail in butfor nowit is sufficient to view this as regular function call that returns an object of type funcanimation this call relies on external software being installed and integrated with matplotlibso it might not work on all platforms