Created
September 4, 2018 01:04
-
-
Save rohanjoseph93/3ce8a91967fa27fbdb64ecb1d6332e8b 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