Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Making it possible to use writer.setup kwargs from animation.save #11863

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions 14 lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def finish(self):
'''Finish any processing for writing the movie.'''

@contextlib.contextmanager
def saving(self, fig, outfile, dpi, *args, **kwargs):
def saving(self, fig, outfile, dpi=None, *args, **kwargs):
'''
Context manager to facilitate writing the movie file.

Expand Down Expand Up @@ -847,7 +847,7 @@ def __init__(self, fps=30, codec=None, bitrate=None, extra_args=None,
self._hit_limit = False
super().__init__(fps, codec, bitrate, extra_args, metadata)

def setup(self, fig, outfile, dpi, frame_dir=None):
def setup(self, fig, outfile, dpi=None, frame_dir=None):
root, ext = os.path.splitext(outfile)
if ext not in ['.html', '.htm']:
raise ValueError("outfile must be *.htm or *.html")
Expand All @@ -861,7 +861,8 @@ def setup(self, fig, outfile, dpi, frame_dir=None):
else:
frame_prefix = None

super().setup(fig, outfile, dpi, frame_prefix, clear_temp=False)
super().setup(fig, outfile, dpi=None, frame_prefix=frame_prefix,
clear_temp=False)

def grab_frame(self, **savefig_kwargs):
if self.embed_frames:
Expand Down Expand Up @@ -1005,7 +1006,7 @@ def _stop(self, *args):

def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
bitrate=None, extra_args=None, metadata=None, extra_anim=None,
savefig_kwargs=None):
savefig_kwargs=None, **kwargs):
'''Saves a movie file by drawing every frame.

Parameters
Expand Down Expand Up @@ -1060,6 +1061,9 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
on to the `savefig` command which is called repeatedly to
save the individual frames.

**kwargs :
Additional kwargs passed to writer.setup().

Notes
-----
fps, codec, bitrate, extra_args, metadata are used to
Expand Down Expand Up @@ -1155,7 +1159,7 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
"frame size to vary, which is inappropriate for "
"animation.")
rcParams['savefig.bbox'] = None
with writer.saving(self._fig, filename, dpi):
with writer.saving(self._fig, filename, dpi, **kwargs):
for anim in all_anim:
# Clear the initial frame
anim._init_draw()
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.