import numpy as np
import matplotlib.pyplot as plt
from gif_animate import animate
from stats import gaussian
import matplotlib.pylab as pylab
from matplotlib import animation
import matplotlib
def plt_g (mu, variance):
xs = np.arange(2,8,0.05)
ys = [gaussian (x, mu, variance) for x in xs]
plt.plot (xs, ys)
plt.ylim((0,1))
mu = 2
sigma = 0.6
def ganimate(frame):
global mu, sigma
if frame < 25:
mu += .2
elif frame == 25:
mu = 5
elif frame < 37:
sigma -= 0.05
else:
sigma += 0.05
plt.cla()
plt_g(mu,sigma)
animate('04_gaussian_animate.gif', ganimate,
frames=80, interval=50, figsize=(6,4))