{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Saving an animation\n\nTo save an animation, simply add the `save_path` kwarg and specify the path\nwhere you want to save the movie, including the extension. NOTE: this\ndepends on having ffmpeg installed on your computer.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# sphinx_gallery_thumbnail_path = '_static/thumbnails/sphx_glr_save_movie_thumb.gif'\n\n# Code source: Andrew Heusser\n# License: MIT\n\nimport hypertools as hyp\nimport numpy as np\n\ngeo = hyp.load('weights', align='hyper')\n\n# Extract data from the geo object\ndata = geo.data\n\ngroup1 = np.mean(data[:17], 0)\ngroup2 = np.mean(data[18:], 0)\n\nhyp.plot([group1, group2], animate=True, save_path='animation.mp4')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.22" } }, "nbformat": 4, "nbformat_minor": 0 }