MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / save

Method save

lib/matplotlib/animation.py:947–1142  ·  view source on GitHub ↗

Save the animation as a movie file by drawing every frame. Parameters ---------- filename : str The output filename, e.g., :file:`mymovie.mp4`. writer : `AbstractMovieWriter` subclass or str, default: :rc:`animation.writer` The write

(self, filename, writer=None, fps=None, dpi=None, codec=None,
             bitrate=None, extra_args=None, metadata=None, extra_anim=None,
             savefig_kwargs=None, *, progress_callback=None)

Source from the content-addressed store, hash-verified

945 self.event_source = None
946
947 def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
948 bitrate=None, extra_args=None, metadata=None, extra_anim=None,
949 savefig_kwargs=None, *, progress_callback=None):
950 """
951 Save the animation as a movie file by drawing every frame.
952
953 Parameters
954 ----------
955 filename : str
956 The output filename, e.g., :file:`mymovie.mp4`.
957
958 writer : `AbstractMovieWriter` subclass or str, default: :rc:`animation.writer`
959 The writer used to grab the frames and create the movie file.
960 This can be an instance of an `AbstractMovieWriter` subclass or a
961 string. The builtin writers are
962
963 ================== ==============================
964 str class
965 ================== ==============================
966 'ffmpeg' `.FFMpegWriter`
967 'ffmpeg_file' `.FFMpegFileWriter`
968 'imagemagick' `.ImageMagickWriter`
969 'imagemagick_file' `.ImageMagickFileWriter`
970 'pillow' `.PillowWriter`
971 'html' `.HTMLWriter`
972 ================== ==============================
973
974 fps : int, optional
975 Movie frame rate (per second). If not set, the frame rate from the
976 animation's frame interval.
977
978 dpi : float, default: :rc:`savefig.dpi`
979 Controls the dots per inch for the movie frames. Together with
980 the figure's size in inches, this controls the size of the movie.
981
982 codec : str, default: :rc:`animation.codec`.
983 The video codec to use. Not all codecs are supported by a given
984 `MovieWriter`.
985
986 bitrate : int, default: :rc:`animation.bitrate`
987 The bitrate of the movie, in kilobits per second. Higher values
988 means higher quality movies, but increase the file size. A value
989 of -1 lets the underlying movie encoder select the bitrate.
990
991 extra_args : list of str or None, optional
992 Extra command-line arguments passed to the underlying movie encoder. These
993 arguments are passed last to the encoder, just before the output filename.
994 The default, None, means to use :rc:`animation.[name-of-encoder]_args` for
995 the builtin writers.
996
997 metadata : dict[str, str], default: {}
998 Dictionary of keys and values for metadata to include in
999 the output file. Some keys that may be of use include:
1000 title, artist, genre, subject, copyright, srcform, comment.
1001
1002 extra_anim : list, default: []
1003 Additional `Animation` objects that should be included
1004 in the saved movie file. These need to be from the same

Callers 15

to_html5_videoMethod · 0.95
to_jshtmlMethod · 0.95
write_pngMethod · 0.80
imsaveFunction · 0.80
finishMethod · 0.80
_repr_png_Method · 0.80
_repr_png_Method · 0.80
_repr_png_Method · 0.80
get_diff_imageMethod · 0.80
set_contextMethod · 0.80
_fill_and_strokeMethod · 0.80
draw_pathMethod · 0.80

Calls 9

savingMethod · 0.80
_draw_next_frameMethod · 0.80
popMethod · 0.45
getMethod · 0.45
get_facecolorMethod · 0.45
_init_drawMethod · 0.45
new_saved_frame_seqMethod · 0.45
grab_frameMethod · 0.45