the resulting gif can be played using animate from imagemagick or in browser note thatfor this approach to workone needs to be careful about the filenames the argument tmp_png passed to the convert function will simply replace with any textthereby sending all files with this pattern to convert the files are sent in lexicographic ( alphabeticalorderwhich is why we use the format specifier in the -string above it would be tempting so simply write {frame_counter}with no format specifierinside the -string to create the unique filenameand not worry about the format specifier this approach would create unique filenames such as tmp_ pngtmp_ pngand so on howeverwe would run into problems when creating the movie with convertsincefor instancetmp_ png comes before tmp_ png in the alphabetic ordering third alternativeusing built-in matplotlib tools the third approach is the most advanced and flexibleand it relies on built-in matplotlib tools instead of the explicit for loop that we used above without an explicit for loopthe actual steps of creating the animation are less obviousand the approach is therefore somewhat less intuitive the essential steps are the following make function to update the plot in our casethis function should compute the new array and call set_ydataas aboveto update the plot make list or array of the argument that changes (in this cases pass the function and the list as arguments to create funcanimation object after creating this objectwe can use various built-in methods to save the movie to fileshow it on the screenand so forth the complete code looks like the followingimport numpy as np import matplotlib pyplot as plt from matplotlib animation import funcanimation def (xms)return ( /(np sqrt( *np pi)* ))*np exp(- *(( - )/ )** s_start s_stop s_values np linspace(s_start,s_stop, np linspace(- *s_start, *s_start max_f ( , ,s_stopplt axis([ [ ], [- ], ,max_f]plt xlabel(' 'plt ylabel(' ' ( , ,s_start