@@ -686,28 +686,35 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
686
686
687
687
*fps* is the frames per second in the movie. Defaults to None,
688
688
which will use the animation's specified interval to set the frames
689
- per second.
689
+ per second. This argument is only valid if *writer* is not a
690
+ :class:`MovieWriter` instance.
690
691
691
692
*dpi* controls the dots per inch for the movie frames. This combined
692
693
with the figure's size in inches controls the size of the movie.
693
694
694
695
*codec* is the video codec to be used. Not all codecs are supported
695
696
by a given :class:`MovieWriter`. If none is given, this defaults to the
696
- value specified by the rcparam `animation.codec`.
697
+ value specified by the rcparam `animation.codec`. This argument is only
698
+ valid if *writer* is not a :class:`MovieWriter` instance.
697
699
698
700
*bitrate* specifies the amount of bits used per second in the
699
701
compressed movie, in kilobits per second. A higher number means a
700
702
higher quality movie, but at the cost of increased file size. If no
701
703
value is given, this defaults to the value given by the rcparam
702
- `animation.bitrate`.
704
+ `animation.bitrate`. This argument is only valid if *writer* is not a
705
+ :class:`MovieWriter` instance.
703
706
704
707
*extra_args* is a list of extra string arguments to be passed to the
705
708
underlying movie utility. The default is None, which passes the
706
- additional arguments in the 'animation.extra_args' rcParam.
709
+ additional arguments in the 'animation.extra_args' rcParam. This
710
+ argument is only valid if *writer* is not a :class:`MovieWriter`
711
+ instance.
707
712
708
713
*metadata* is a dictionary of keys and values for metadata to include
709
714
in the output file. Some keys that may be of use include:
710
- title, artist, genre, subject, copyright, srcform, comment.
715
+ title, artist, genre, subject, copyright, srcform, comment. This
716
+ argument is only valid if *writer* is not a :class:`MovieWriter`
717
+ instance.
711
718
712
719
*extra_anim* is a list of additional `Animation` objects that should
713
720
be included in the saved movie file. These need to be from the same
@@ -720,6 +727,20 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
720
727
the individual frames. This can be used to set tight bounding boxes,
721
728
for example.
722
729
'''
730
+ # If the writer is None, use the rc param to find the name of the one
731
+ # to use
732
+ if writer is None :
733
+ writer = rcParams ['animation.writer' ]
734
+ elif (not is_string_like (writer ) and
735
+ any (arg is not None
736
+ for arg in (fps , codec , bitrate , extra_args , metadata ))):
737
+ raise RuntimeError ('Passing in values for arguments for arguments '
738
+ 'fps, codec, bitrate, extra_args, or metadata '
739
+ 'is not supported when writer is an existing '
740
+ 'MovieWriter instance. These should instead be '
741
+ 'passed as arguments when creating the '
742
+ 'MovieWriter instance.' )
743
+
723
744
if savefig_kwargs is None :
724
745
savefig_kwargs = {}
725
746
@@ -735,11 +756,6 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
735
756
# Convert interval in ms to frames per second
736
757
fps = 1000. / self ._interval
737
758
738
- # If the writer is None, use the rc param to find the name of the one
739
- # to use
740
- if writer is None :
741
- writer = rcParams ['animation.writer' ]
742
-
743
759
# Re-use the savefig DPI for ours if none is given
744
760
if dpi is None :
745
761
dpi = rcParams ['savefig.dpi' ]
0 commit comments