Created
September 3, 2018 23:41
-
-
Save rohanjoseph93/2088e2c4008a4308de74d880410d5eb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function that will plot the histogram, where current is the latest figure | |
def clt(current): | |
# if animation is at the last frame, stop it | |
plt.cla() | |
if current == 1000: | |
a.event_source.stop() | |
plt.hist(avg[0:current]) | |
plt.gca().set_title('Expected value of die rolls') | |
plt.gca().set_xlabel('Average from die roll') | |
plt.gca().set_ylabel('Frequency') | |
plt.annotate('Die roll = {}'.format(current), [3,27]) | |
fig = plt.figure() | |
a = animation.FuncAnimation(fig, clt, interval=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment