Skip to content

Commit 1a6c61c

Browse files
committed
DOC: address the rest of the comments
1 parent 55017cd commit 1a6c61c

File tree

2 files changed

+43
-39
lines changed

2 files changed

+43
-39
lines changed

doc/api/animation_api.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Animation
1414
=========
1515

16-
The easiest way to make a live animation in mpl is to use one of the
16+
The easiest way to make a live animation in matplotlib is to use one of the
1717
`Animation` classes.
1818

1919
.. autosummary::
@@ -30,7 +30,7 @@ to. If you do not hold a reference to the `Animation` object, it (and
3030
hence the timers), will be garbage collected which will stop the
3131
animation.
3232

33-
To save an animation use to disk use
33+
To save an animation to disk use
3434

3535
.. autosummary::
3636
:toctree: _as_gen
@@ -48,7 +48,7 @@ See :ref:`ani_writer_classes` below for details about what movie formats are sup
4848
The inner workings of `FuncAnimation` is more-or-less::
4949

5050
for d in frames:
51-
arts = func(d, *fargs)
51+
artists = func(d, *fargs)
5252
fig.canvas.draw_idle()
5353
plt.pause(interval)
5454

@@ -59,7 +59,7 @@ axes, and easily save the animation to a movie file.
5959

6060
'Blitting' is a `old technique
6161
<https://en.wikipedia.org/wiki/Bit_blit>`__ in computer graphics. The
62-
general gist is to take as existing bit map (in our case a mostly
62+
general gist is to take an existing bit map (in our case a mostly
6363
rasterized figure) and then 'blit' one more artist on top. Thus, by
6464
managing a saved 'clean' bitmap, we can only re-draw the few artists
6565
that are changing at each frame and possibly save significant amounts of
@@ -68,24 +68,24 @@ time. When using blitting (by passing ``blit=True``) the core loop of
6868

6969
ax = fig.gca()
7070

71-
def update_blit(arts):
71+
def update_blit(artists):
7272
fig.canvas.restore_region(bg_cache)
73-
for a in arts:
73+
for a in artists:
7474
a.axes.draw_artist(a)
7575

7676
ax.figure.canvas.blit(ax.bbox)
7777

78-
arts = init_func()
78+
artists = init_func()
7979

80-
for a in arts:
80+
for a in artists:
8181
a.set_animated(True)
8282

8383
fig.canvas.draw()
8484
bg_cache = fig.canvas.copy_from_bbox(ax.bbox)
8585

8686
for f in frames:
87-
arts = func(f, *fargs)
88-
update_blit(arts)
87+
artists = func(f, *fargs)
88+
update_blit(artists)
8989
plt.pause(interval)
9090

9191
This is of course leaving out many details (such as updating the
@@ -98,7 +98,7 @@ The expected signature on ``func`` and ``init_func`` is very simple to
9898
keep `FuncAnimation` out of your book keeping and plotting logic, but
9999
this means that the callable objects you pass in must know what
100100
artists they should be working on. There are several approaches to
101-
handling this, of varying complexity and encapsulation. The simplest
101+
handling this, of varying complexity and encapsulation. The simplest
102102
approach, which works quite well in the case of a script, is to define the
103103
artist at a global scope and let Python sort things out. For example ::
104104

@@ -200,7 +200,7 @@ slower, these writers can be easier to debug.
200200
AVConvFileWriter
201201

202202

203-
Fundamentally, a MovieWriter does is provide is a way to grab
203+
Fundamentally, a `MovieWriter` does is provide is a way to grab
204204
sequential frames from the same underlying `~matplotlib.figure.Figure`
205205
object. The base class `MovieWriter` implements 3 methods and a
206206
context manager. The only difference between the pipe-based and

lib/matplotlib/animation.py

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ class FFMpegBase(object):
486486
'''Mixin class for FFMpeg output
487487
488488
To be useful this must be multiply-inherited from with a
489-
`MoveWriterBase` sub-class.
489+
`MovieWriterBase` sub-class.
490490
'''
491491

492492
exec_key = 'animation.ffmpeg_path'
@@ -560,7 +560,7 @@ class AVConvBase(FFMpegBase):
560560
'''Mixin class for avconv output
561561
562562
To be useful this must be multiply-inherited from with a
563-
`MoveWriterBase` sub-class.
563+
`MovieWriterBase` sub-class.
564564
'''
565565

566566
exec_key = 'animation.avconv_path'
@@ -671,7 +671,7 @@ class ImageMagickBase(object):
671671
'''Mixin class for ImageMagick output
672672
673673
To be useful this must be multiply-inherited from with a
674-
`MoveWriterBase` sub-class.
674+
`MovieWriterBase` sub-class.
675675
'''
676676

677677
exec_key = 'animation.convert_path'
@@ -850,7 +850,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
850850
----------
851851
852852
filename : str
853-
the output filename, e.g., :file:`mymovie.mp4`
853+
The output filename, e.g., :file:`mymovie.mp4`
854854
855855
writer : :class:`MovieWriter` or str, optional
856856
A `MovieWriter` instance to use or a key that identifies a
@@ -863,48 +863,48 @@ class to use, such as 'ffmpeg' or 'mencoder'. If `None`,
863863
the frames per second.
864864
865865
dpi : number, optional
866-
controls the dots per inch for the movie frames. This
866+
Controls the dots per inch for the movie frames. This
867867
combined with the figure's size in inches controls the size of
868868
the movie. If None, defaults to ``rcparam['savefig.dpi']``
869869
870870
codec : str, optional
871-
the video codec to be used. Not all codecs are supported by
871+
The video codec to be used. Not all codecs are supported by
872872
a given :class:`MovieWriter`. If `None`,
873873
default to ``rcParams['animation.codec']``
874874
875875
bitrate : number, optional
876-
specifies the amount of bits used per second in the
876+
Specifies the amount of bits used per second in the
877877
compressed movie, in kilobits per second. A higher number
878878
means a higher quality movie, but at the cost of increased
879879
file size. If `None`, defaults to
880880
``rcParam['animation.bitrate']``
881881
882882
extra_args : list, optional
883-
list of extra string arguments to be passed to the
883+
List of extra string arguments to be passed to the
884884
underlying movie utility. If `None`, defaults to
885885
``rcParams['animation.extra_args']``
886886
887887
metadata : dict, optional
888-
dictionary of keys and values for metadata to include in
888+
Dictionary of keys and values for metadata to include in
889889
the output file. Some keys that may be of use include:
890890
title, artist, genre, subject, copyright, srcform, comment.
891891
892892
extra_anim : list, optional
893-
additional `Animation` objects that should be included in
893+
Additional `Animation` objects that should be included in
894894
the saved movie file. These need to be from the same
895895
`matplotlib.Figure` instance. Also, animation frames will
896896
just be simply combined, so there should be a 1:1
897897
correspondence between the frames from the different
898898
animations.
899899
900900
savefig_kwargs : dict, optional
901-
is a dictionary containing keyword arguments to be passed
901+
Is a dictionary containing keyword arguments to be passed
902902
on to the 'savefig' command which is called repeatedly to
903903
save the individual frames.
904904
905905
Notes
906906
-----
907-
fps, codec, bitrate, extra_args, metadata are used are used to
907+
fps, codec, bitrate, extra_args, metadata are used to
908908
construct a :class:`MovieWriter` instance and can only be
909909
passed if `writer` is a string. If they are passed as
910910
non-`None` and ``writer`` is a :class:`MovieWriter`, a
@@ -1201,13 +1201,13 @@ class TimedAnimation(Animation):
12011201
If the animation in repeated, adds a delay in milliseconds
12021202
before repeating the animation. Defaults to None
12031203
1204-
repeat: bool, optional
1205-
controls whether the animation should repeat when the sequence
1204+
repeat : bool, optional
1205+
Controls whether the animation should repeat when the sequence
12061206
of frames is completed. Defaults to `True`.
12071207
12081208
blit : bool, optional
1209-
controls whether blitting is used to optimize drawing. Defaults
1210-
to `False`.
1209+
Controls whether blitting is used to optimize drawing. Defaults
1210+
to `False`.
12111211
12121212
'''
12131213
def __init__(self, fig, interval=200, repeat_delay=None, repeat=True,
@@ -1279,7 +1279,7 @@ class ArtistAnimation(TimedAnimation):
12791279
other needed events.
12801280
12811281
artists : list
1282-
with each list entry a collection of artists that
1282+
With each list entry a collection of artists that
12831283
represent what needs to be enabled on each frame. These will
12841284
be disabled for other frames.
12851285
@@ -1290,13 +1290,13 @@ class ArtistAnimation(TimedAnimation):
12901290
If the animation in repeated, adds a delay in milliseconds
12911291
before repeating the animation. Defaults to `None`.
12921292
1293-
repeat: bool, optional
1294-
controls whether the animation should repeat when the sequence
1293+
repeat : bool, optional
1294+
Controls whether the animation should repeat when the sequence
12951295
of frames is completed. Defaults to `True`.
12961296
12971297
blit : bool, optional
1298-
controls whether blitting is used to optimize drawing. Defaults
1299-
to `False`.
1298+
Controls whether blitting is used to optimize drawing. Defaults
1299+
to `False`.
13001300
13011301
'''
13021302
def __init__(self, fig, artists, *args, **kwargs):
@@ -1374,12 +1374,16 @@ def func(fr: object, *fargs) -> iterable_of_artists:
13741374
13751375
If a generator function, then must have the signature ::
13761376
1377-
def gen_function():
1377+
def gen_function() -> obj:
1378+
1379+
In all of these cases, the values in `frames` is simply
1380+
passed through to the user-supplied `func` and thus can be
1381+
of any type.
13781382
1379-
If `None`, then equivalent to passing ``itertools.count``
1383+
If `None`, then equivalent to passing ``itertools.count``.
13801384
13811385
init_func : callable, optional
1382-
a function used to draw a clear frame. If not given, the
1386+
A function used to draw a clear frame. If not given, the
13831387
results of drawing from the first item in the frames sequence
13841388
will be used. This function will be called once before the
13851389
first frame.
@@ -1404,12 +1408,12 @@ def init_func() -> iterable_of_artists:
14041408
If the animation in repeated, adds a delay in milliseconds
14051409
before repeating the animation. Defaults to `None`.
14061410
1407-
repeat: bool, optional
1408-
controls whether the animation should repeat when the sequence
1411+
repeat : bool, optional
1412+
Controls whether the animation should repeat when the sequence
14091413
of frames is completed. Defaults to `True`
14101414
14111415
blit : bool, optional
1412-
controls whether blitting is used to optimize drawing. Defaults
1416+
Controls whether blitting is used to optimize drawing. Defaults
14131417
to `False`.
14141418
14151419
'''

0 commit comments

Comments
 (0)