Skip to content

Commit 978093f

Browse files
committed
2 parents ad45d25 + 37cf5f3 commit 978093f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

examples/ch01/RollDieDynamic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def update(frame_number, rolls, faces, frequencies):
3737

3838
# configure and start animation that calls function update
3939
die_animation = animation.FuncAnimation(
40-
figure, update, repeat=False, frames=number_of_frames, interval=33,
40+
figure, update, repeat=False, frames=number_of_frames - 1, interval=33,
4141
fargs=(rolls_per_frame, values, frequencies))
4242

4343
plt.show() # display window

examples/ch05/RollDie.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
title = f'Rolling a Six-Sided Die {len(rolls):,} Times'
1616
sns.set_style('whitegrid') # white backround with gray grid lines
17-
axes = sns.barplot(values, frequencies, palette='bright') # create bars
17+
axes = sns.barplot(x=values, y=frequencies, palette='bright') # create bars
1818
axes.set_title(title) # set graph title
1919
axes.set(xlabel='Die Value', ylabel='Frequency') # label the axes
2020

examples/ch06/RollDieDynamic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def update(frame_number, rolls, faces, frequencies):
1414

1515
# reconfigure plot for updated die frequencies
1616
plt.cla() # clear old contents contents of current Figure
17-
axes = sns.barplot(faces, frequencies, palette='bright') # new bars
17+
axes = sns.barplot(x=faces, y=frequencies, palette='bright') # new bars
1818
axes.set_title(f'Die Frequencies for {sum(frequencies):,} Rolls')
1919
axes.set(xlabel='Die Value', ylabel='Frequency')
2020
axes.set_ylim(top=max(frequencies) * 1.10) # scale y-axis by 10%
@@ -37,7 +37,7 @@ def update(frame_number, rolls, faces, frequencies):
3737

3838
# configure and start animation that calls function update
3939
die_animation = animation.FuncAnimation(
40-
figure, update, repeat=False, frames=number_of_frames, interval=33,
40+
figure, update, repeat=False, frames=number_of_frames - 1, interval=33,
4141
fargs=(rolls_per_frame, values, frequencies))
4242

4343
plt.show() # display window

0 commit comments

Comments
 (0)