8000 Distinguish AbstractMovieWriter and MovieWriter in docs. by anntzer · Pull Request #21948 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Distinguish AbstractMovieWriter and MovieWriter in docs. #21948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2021

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Dec 14, 2021

Some docs of AbstractMovieWriter are still written as if referring to
MovieWriter (which could be better named PipeMovieWriter, i.e. writers
that pipe frame data to a running subprocess). This probably dates
back to when AbstractMovieWriter was not a thing yet.

Fix that.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@tacaswell tacaswell added this to the v3.5.2 milestone Dec 14, 2021
Comment on lines 214 to 218
Fundamentally, an `AbstractMovieWriter` provides a way to grab sequential
frames from the same underlying `~matplotlib.figure.Figure` object. The
base `AbstractMovieWriter` class implements 3 methods and a context manager.
The only difference between the pipe-based and file-based writers is in the
arguments to their respective ``setup`` methods.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Fundamentally, an `AbstractMovieWriter` provides a way to grab sequential
frames from the same underlying `~matplotlib.figure.Figure` object. The
base `AbstractMovieWriter` class implements 3 methods and a context manager.
The only difference between the pipe-based and file-based writers is in the
arguments to their respective ``setup`` methods.
The writer classes provide a way to grab sequential frames from the same
underlying `~matplotlib.figure.Figure` object. They all provide 3 methods
that must be called in sequence:
- `~-AbstractMovieWriter.setu 8000 p` prepares the writer (e.g. opening a pipe).
Pipe-based and file-based writers take different arguments to ``setup()``.
- `~.AbstractMovieWriter.grab_frame` can then be called as often as
needed to capture a single frame at a time
- `~.AbstractMovieWriter.finish` finalizes the movie and writes the output
file to disk.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it doesn't make sense to specifically mention AbstractMovieWriter because nobody will use that class. Instead, we can more informally say "all writer classes".

Note also that #21954 moves the ineritance diagram here and adds missing classes, which should make the relations more clear.

Comment on lines 220 to 223
The `~AbstractMovieWriter.setup` method is used to prepare the writer (possibly
opening a pipe), successive calls to `~.AbstractMovieWriter.grab_frame` capture
a single frame at a time and `~.AbstractMovieWriter.finish` finalizes the movie
and writes the output file to disk. For example ::
Copy link
Member
@timhoffm timhoffm Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `~AbstractMovieWriter.setup` method is used to prepare the writer (possibly
opening a pipe), successive calls to `~.AbstractMovieWriter.grab_frame` capture
a single frame at a time and `~.AbstractMovieWriter.finish` finalizes the movie
and writes the output file to disk. For example ::
Example::

@anntzer
Copy link
Contributor Author
anntzer commented Dec 14, 2021

Thanks @timhoffm, I've integrated your changes, they look great.

I also updated an example a bit earlier in the text to use 4-space indents.

Some docs of AbstractMovieWriter are still written as if referring to
MovieWriter (which could be better named PipeMovieWriter, i.e. writers
that pipe frame data to a running subprocess).  This probably dates
back to when AbstractMovieWriter was not a thing yet.

Fix that.
@timhoffm timhoffm merged commit ee3cb9a into matplotlib:main Dec 15, 2021
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Dec 15, 2021
@anntzer anntzer deleted the animdoc branch December 15, 2021 20:35
QuLogic added a commit that referenced this pull request Dec 16, 2021
…948-on-v3.5.x

Backport PR #21948 on branch v3.5.x (Distinguish AbstractMovieWriter and MovieWriter in docs.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0