Skip to content

Commit 448b5a7

Browse files
authored
add an optional gif_file parameter to show_anim (#41)
1 parent 3a9b85b commit 448b5a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

open_atmos_jupyter_utils/show_anim.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from open_atmos_jupyter_utils.temporary_file import TemporaryFile
1212

1313

14-
def show_anim(plot_func, frame_range, duration=0.01, loop=0):
14+
def show_anim(plot_func, frame_range, duration=0.01, loop=0, gif_file=None):
1515
"""plot_func is called with one argument - the frame number from frame_range
1616
and is expected to return a matplotlib figure instance (on which savefig()
1717
and close() are subsequently called)"""
18-
gif_file = TemporaryFile(suffix=".gif")
18+
gif_file = gif_file or TemporaryFile(suffix=".gif")
1919
with tempfile.TemporaryDirectory() as tmpdirname:
2020
for frame in frame_range:
2121
fig = plot_func(frame)

0 commit comments

Comments
 (0)