Save the animation as a movie file by drawing every frame. Parameters ---------- filename : str The output filename, e.g., :file:`mymovie.mp4`. writer : :class:`MovieWriter` or str, optional A `MovieWriter` instance to use or a key
(self, filename, writer=None, fps=None, dpi=None, codec=None,
bitrate=None, extra_args=None, metadata=None, extra_anim=None,
savefig_kwargs=None)
| 1015 | self.event_source = None |
| 1016 | |
| 1017 | def save(self, filename, writer=None, fps=None, dpi=None, codec=None, |
| 1018 | bitrate=None, extra_args=None, metadata=None, extra_anim=None, |
| 1019 | savefig_kwargs=None): |
| 1020 | """ |
| 1021 | Save the animation as a movie file by drawing every frame. |
| 1022 | |
| 1023 | Parameters |
| 1024 | ---------- |
| 1025 | |
| 1026 | filename : str |
| 1027 | The output filename, e.g., :file:`mymovie.mp4`. |
| 1028 | |
| 1029 | writer : :class:`MovieWriter` or str, optional |
| 1030 | A `MovieWriter` instance to use or a key that identifies a |
| 1031 | class to use, such as 'ffmpeg'. If ``None``, defaults to |
| 1032 | :rc:`animation.writer` = 'ffmpeg'. |
| 1033 | |
| 1034 | fps : number, optional |
| 1035 | Frames per second in the movie. Defaults to ``None``, which will use |
| 1036 | the animation's specified interval to set the frames per second. |
| 1037 | |
| 1038 | dpi : number, optional |
| 1039 | Controls the dots per inch for the movie frames. This combined with |
| 1040 | the figure's size in inches controls the size of the movie. If |
| 1041 | ``None``, defaults to :rc:`savefig.dpi`. |
| 1042 | |
| 1043 | codec : str, optional |
| 1044 | The video codec to be used. Not all codecs are supported |
| 1045 | by a given :class:`MovieWriter`. If ``None``, default to |
| 1046 | :rc:`animation.codec` = 'h264'. |
| 1047 | |
| 1048 | bitrate : number, optional |
| 1049 | Specifies the number of bits used per second in the compressed |
| 1050 | movie, in kilobits per second. A higher number means a higher |
| 1051 | quality movie, but at the cost of increased file size. If ``None``, |
| 1052 | defaults to :rc:`animation.bitrate` = -1. |
| 1053 | |
| 1054 | extra_args : list, optional |
| 1055 | List of extra string arguments to be passed to the underlying movie |
| 1056 | utility. If ``None``, defaults to :rc:`animation.extra_args`. |
| 1057 | |
| 1058 | metadata : Dict[str, str], optional |
| 1059 | Dictionary of keys and values for metadata to include in |
| 1060 | the output file. Some keys that may be of use include: |
| 1061 | title, artist, genre, subject, copyright, srcform, comment. |
| 1062 | |
| 1063 | extra_anim : list, optional |
| 1064 | Additional `Animation` objects that should be included |
| 1065 | in the saved movie file. These need to be from the same |
| 1066 | `matplotlib.figure.Figure` instance. Also, animation frames will |
| 1067 | just be simply combined, so there should be a 1:1 correspondence |
| 1068 | between the frames from the different animations. |
| 1069 | |
| 1070 | savefig_kwargs : dict, optional |
| 1071 | Is a dictionary containing keyword arguments to be passed |
| 1072 | on to the `savefig` command which is called repeatedly to |
| 1073 | save the individual frames. |
| 1074 |