Skip to content

Commit e2c578c

Browse files
committed
updating commit
1 parent 9e3d753 commit e2c578c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

galleries/examples/animation/animated_FuncAnimation.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
22
==================================
3-
Parameterized Animation Functions
3+
Parameterized animation function
44
==================================
5-
use FuncAnimation to show counts of widgets over the decades
5+
use `~.Animation.FuncAnimation` to show counts of widgets over the decades
66
"""
77

88
import functools
@@ -19,7 +19,7 @@ def update(frame, line, text, decades, widgets_data):
1919
# line (Line2D): The line object to update.
2020
# text (Text): The text annotation object to update.
2121
# decades (numpy.ndarray): Array of decades.
22-
# widgets_data (numpy.ndarray): Array of widgets' data.
22+
# widgets_data (numpy.ndarray): Array of widgets data.
2323

2424
# Returns:
2525
# tuple: Tuple containing the updated Line2D and Text objects.
@@ -45,16 +45,19 @@ def update(frame, line, text, decades, widgets_data):
4545

4646
# Set up the initial plot
4747
fig, ax = plt.subplots()
48-
ax.set_xlim(1940, 2020)
49-
ax.set_ylim(0, max(widgets_data) + 100000)
48+
49+
# line being animated
5050
line, = ax.plot([], [])
51-
ax.set_xlabel('Decade')
52-
ax.set_ylabel('Number of Widgets')
5351

5452
# Text annotation to display the current decade
5553
text = ax.text(0.5, 0.85, '', transform=ax.transAxes,
5654
fontsize=12, ha='center', va='center')
5755

56+
ax.set(xlabel='Decade', ylabel='Number of Widgets',
57+
xlim=(1940, 2020),
58+
ylim=(0, max(widgets_data) + 100000))
59+
60+
5861
ani = animation.FuncAnimation(
5962
fig, # Figure to update
6063
functools.partial(update, line=line, text=text,

0 commit comments

Comments
 (0)