@@ -155,17 +155,17 @@ class AbstractMovieWriter(six.with_metaclass(abc.ABCMeta)):
155
155
'''
156
156
157
157
@abc .abstractmethod
158
- def setup (self , fig , outfile , dpi ):
158
+ def setup (self , fig , outfile , dpi = None ):
159
159
'''
160
160
Perform setup for writing the movie file.
161
161
162
162
fig: `matplotlib.Figure` instance
163
163
The figure object that contains the information for frames
164
164
outfile: string
165
165
The filename of the resulting movie file
166
- dpi: int
166
+ dpi: int, optional
167
167
The DPI (or resolution) for the file. This controls the size
168
- in pixels of the resulting movie file.
168
+ in pixels of the resulting movie file. Default is fig.dpi.
169
169
'''
170
170
171
171
@abc .abstractmethod
@@ -281,7 +281,7 @@ def _adjust_frame_size(self):
281
281
verbose .report ('frame size in pixels is %s x %s' % self .frame_size ,
282
282
level = 'debug' )
283
283
284
- def setup (self , fig , outfile , dpi ):
284
+ def setup (self , fig , outfile , dpi = None ):
285
285
'''
286
286
Perform setup for writing the movie file.
287
287
@@ -292,12 +292,14 @@ def setup(self, fig, outfile, dpi):
292
292
The figure object that contains the information for frames
293
293
outfile : string
294
294
The filename of the resulting movie file
295
- dpi : int
295
+ dpi : int, optional
296
296
The DPI (or resolution) for the file. This controls the size
297
- in pixels of the resulting movie file.
297
+ in pixels of the resulting movie file. Default is fig.dpi.
298
298
'''
299
299
self .outfile = outfile
300
300
self .fig = fig
301
+ if dpi is None :
302
+ dpi = self .fig .dpi
301
303
self .dpi = dpi
302
304
self ._adjust_frame_size ()
303
305
@@ -404,7 +406,8 @@ def __init__(self, *args, **kwargs):
404
406
MovieWriter .__init__ (self , * args , ** kwargs )
405
407
self .frame_format = rcParams ['animation.frame_format' ]
406
408
407
- def setup (self , fig , outfile , dpi , frame_prefix = '_tmp' , clear_temp = True ):
409
+ def setup (self , fig , outfile , dpi = None , frame_prefix = '_tmp' ,
410
+ clear_temp = True ):
408
411
'''Perform setup for writing the movie file.
409
412
410
413
Parameters
@@ -413,9 +416,10 @@ def setup(self, fig, outfile, dpi, frame_prefix='_tmp', clear_temp=True):
413
416
The figure to grab the rendered frames from.
414
417
outfile : str
415
418
The filename of the resulting movie file.
416
- dpi : number
419
+ dpi : number, optional
417
420
The dpi of the output file. This, with the figure size,
418
421
controls the size in pixels of the resulting movie file.
422
+ Default is fig.dpi.
419
423
frame_prefix : str, optional
420
424
The filename prefix to use for temporary files. Defaults to
421
425
'_tmp'.
@@ -427,6 +431,8 @@ def setup(self, fig, outfile, dpi, frame_prefix='_tmp', clear_temp=True):
427
431
'''
428
432
self .fig = fig
429
433
self .outfile = outfile
434
+ if dpi is None :
435
+ dpi = self .fig .dpi
430
436
self .dpi = dpi
431
437
self ._adjust_frame_size ()
432
438
0 commit comments