{ "cells": [ { "cell_type": "markdown", "id": "2f10b3a6", "metadata": {}, "source": [ "# SubplotAnimation" ] }, { "cell_type": "code", "execution_count": null, "id": "52d51b5f", "metadata": {}, "outputs": [], "source": [ "from smpl_animation import animation\n", "from smpl import plot\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import tqdm" ] }, { "cell_type": "markdown", "id": "4569693b", "metadata": {}, "source": [ "## Tight" ] }, { "cell_type": "code", "execution_count": null, "id": "0f260438", "metadata": {}, "outputs": [], "source": [ "%matplotlib notebook \n", "plt.ioff()\n", "for a in tqdm.tqdm(np.linspace(0,10,200)):\n", " fig, axs = plot.subplots(1, 3, figsize=(12, 8), sharey=True)\n", " fig.subplots_adjust(wspace=0)\n", "\n", " plot.function(lambda x: a*x**2,axes=axs[0],tight=False,xmin=0,xmax=1)\n", " plot.function(lambda x: a*x**5,axes=axs[0],tight=False,xmin=0,xmax=1)\n", " plot.function(lambda x: a*x**3,axes=axs[1],logx=True,tight=False,xmin=0,xmax=1)\n", " plot.function(lambda x: a*x**1,axes=axs[2],tight=False,xmin=0,xmax=1)\n", " animation.frame()\n", "\n", "#ani.save(\"test.gif\")\n", "ani = animation.animate(interval=10,blit=True)\n", "plt.show()" ] }, { "cell_type": "markdown", "id": "ac0103eb", "metadata": {}, "source": [ "## Normal" ] }, { "cell_type": "code", "execution_count": null, "id": "3227195d", "metadata": {}, "outputs": [], "source": [ "%matplotlib notebook \n", "plt.ioff()\n", "animation.clear()\n", "for a in tqdm.tqdm(np.linspace(0,10,200)):\n", " fig, axs = plot.subplots(1, 3, figsize=(12, 8), sharey=True)\n", " fig.subplots_adjust(wspace=0)\n", "\n", " plot.function(lambda x: a*x**2,axes=axs[0],xmin=0,xmax=1)\n", " plot.function(lambda x: a*x**5,axes=axs[0],xmin=0,xmax=1)\n", " plot.function(lambda x: a*x**3,axes=axs[1],logx=True,xmin=0,xmax=1)\n", " plot.function(lambda x: a*x**1,axes=axs[2],xmin=0,xmax=1)\n", " animation.frame()\n", "\n", "#ani.save(\"test.gif\")\n", "ani = animation.animate(interval=10,blit=True)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "id": "49ab28ba", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "81a86be9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "99b51ed6", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.15" } }, "nbformat": 4, "nbformat_minor": 5 }