arrays and plotting herewe compute the maximum value that the function will obtain in the line max_f (mms_stop(based on either prior knowledge about the gaussian function or inspection of the mathematical expressionthis value is then used to set the axes for all the plots that make up the movie second alternativesaving image files for later processing this approach is very similar to the one abovebutinstead of showing the plots on the screenwe save them to filesusing the savefig function from matplotlib to avoid having each new plot over-write the previous filewe must include counter variable and formatted string to create unique filename for each iteration of the for loop the complete code is nearly identical to the one aboveimport matplotlib pyplot as plt import numpy as np def (xms)return ( /(np sqrt( *np pi)* ))*np exp(- *(( - )/ )** s_start s_stop s_values np linspace(s_starts_stop np linspace( - *s_startm *s_start is max for = (smaller gives larger max valuemax_f (mms_stopy ( , ,s_stoplines plt plot( ,yplt axis([ [ ] [- ]- max_f]plt xlabel(' 'plt ylabel(' 'frame_counter for in s_valuesy (xmslines[ set_ydata( #update plot data and redraw plt draw(plt savefig( 'tmp_{frame_counter: dpng'#unique filename frame_counter + running this program should create number of image filesall located in the directory in which we run the program converting these images into movie requires external softwarefor instanceconvert from the imagemagick software suite to make animated gifsor ffmpeg or avconv to make mp and other movie formats for instanceif we want to create an animated gif of the image files produced abovethe following command will do the trickterminal terminalconvert -delay tmp_png movie gif