{ "info": { "author": "Jacques Kvam", "author_email": "jwkvam+pypi@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# celluloid\n\n[![Build Status](https://travis-ci.com/jwkvam/celluloid.svg?branch=master)](https://travis-ci.com/jwkvam/celluloid)\n[![codecov](https://codecov.io/gh/jwkvam/celluloid/branch/master/graph/badge.svg)](https://codecov.io/gh/jwkvam/celluloid)\n[![pypi](https://badge.fury.io/py/celluloid.svg)](https://pypi.org/project/celluloid/)\n[![pypi versions](https://img.shields.io/pypi/pyversions/celluloid.svg)](https://pypi.org/project/celluloid/)\n\nEasy Matplotlib Animation\n\n

\n \n \n \n

\n\nCreating animations should be easy.\nThis module makes it easy to adapt your existing visualization code to create an animation.\n\n## Install\n\n```\npip install celluloid\n```\n\n## Manual\n\nFollow these steps:\n\n1. Create a matplotlib `Figure` and create a `Camera` from it:\n\n```python\nfrom celluloid import Camera\nfig = plt.figure()\ncamera = Camera(fig)\n```\n\n2. Reusing the figure and after each frame is created, take a snapshot with the camera.\n\n```python\nplt.plot(...)\nplt.fancy_stuff()\ncamera.snap()\n```\n\n3. After all frames have been captured, create the animation.\n\n```python\nanimation = camera.animate()\nanimation.save('animation.mp4')\n```\n\nThe entire [module](https://github.com/jwkvam/celluloid/blob/master/celluloid.py) is less than 50 lines of code.\n\n## Examples\n\n### Minimal\n\nAs simple as it gets.\n\n```python\nfrom matplotlib import pyplot as plt\nfrom celluloid import Camera\n\nfig = plt.figure()\ncamera = Camera(fig)\nfor i in range(10):\n plt.plot([i] * 10)\n camera.snap()\nanimation = camera.animate()\n```\n\n

\n \n \n \n

\n\n### Subplots\n\nAnimation at the top.\n\n```python\nimport numpy as np\nfrom matplotlib import pyplot as plt\nfrom celluloid import Camera\n\nfig, axes = plt.subplots(2)\ncamera = Camera(fig)\nt = np.linspace(0, 2 * np.pi, 128, endpoint=False)\nfor i in t:\n axes[0].plot(t, np.sin(t + i), color='blue')\n axes[1].plot(t, np.sin(t - i), color='blue')\n camera.snap()\nanimation = camera.animate()\n```\n\n### Images\n\nDomain coloring example.\n\n```python\nimport numpy as np\nfrom matplotlib import pyplot as plt\nfrom matplotlib.colors import hsv_to_rgb\n\nfrom celluloid import Camera\n\nfig = plt.figure()\ncamera = Camera(fig)\n\nfor a in np.linspace(0, 2 * np.pi, 30, endpoint=False):\n x = np.linspace(-3, 3, 800)\n X, Y = np.meshgrid(x, x)\n x = X + 1j * Y\n y = (x ** 2 - 2.5) * (x - 2.5 * 1j) * (x + 2.5 * 1j) \\\n * (x - 2 - 1j) ** 2 / ((x - np.exp(1j * a)) ** 2\n * (x - np.exp(1j * 2 * a)) ** 2)\n\n H = np.angle(y) / (2 * np.pi) + .5\n r = np.log2(1. + np.abs(y))\n S = (1. + np.abs(np.sin(2. * np.pi * r))) / 2.\n V = (1. + np.abs(np.cos(2. * np.pi * r))) / 2.\n\n rgb = hsv_to_rgb(np.dstack((H, S, V)))\n ax.imshow(rgb)\n camera.snap()\nanimation = camera.animate()\n```\n\n

\n \n \n \n

\n\n### Legends\n\n```python\nimport matplotlib\nfrom matplotlib import pyplot as plt\nfrom celluloid import Camera\n\nfig = plt.figure()\ncamera = Camera(fig)\nfor i in range(5):\n t = plt.plot(range(i, i + 5))\n plt.legend(t, [f'line {i}'])\n camera.snap()\nanimation = camera.animate()\n```\n\n

\n \n \n \n

\n\n## Limitations\n\n- The axes' limits should be the same for all plots. The limits of the animation will be the limits of the final plot.\n- Legends will accumulate from previous frames. Pass the artists to the `legend` function to draw them separately.\n\n## Credits\n\nInspired by [plotnine](https://github.com/has2k1/plotnine/blob/master/plotnine/animation.py).\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jwkvam/celluloid", "keywords": "matplotlib animation", "license": "", "maintainer": "", "maintainer_email": "", "name": "celluloid", "package_url": "https://pypi.org/project/celluloid/", "platform": "", "project_url": "https://pypi.org/project/celluloid/", "project_urls": { "Homepage": "https://github.com/jwkvam/celluloid" }, "release_url": "https://pypi.org/project/celluloid/0.2.0/", "requires_dist": [ "matplotlib" ], "requires_python": ">=3.6", "summary": "Easy matplotlib animation.", "version": "0.2.0" }, "last_serial": 4505773, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "9fdadb462a3ea3647afa3bb133cae4f0", "sha256": "274f1835a497c6c990583c43dceb20a16c7f89b3d681ecfff604284e9213be15" }, "downloads": -1, "filename": "celluloid-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9fdadb462a3ea3647afa3bb133cae4f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 4710, "upload_time": "2018-11-17T22:06:25", "url": "https://files.pythonhosted.org/packages/71/1f/42fedd7e81151cbc81d74967da2f25125e99aeccb3c8906c1a5b40e68f63/celluloid-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cc1e59a4d23048e2e90e7e913b60a1f4", "sha256": "d99a1848d2d64e78eb14aa0bbe2ae3b1376725352abe8bf0a6a750a0a026b290" }, "downloads": -1, "filename": "celluloid-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cc1e59a4d23048e2e90e7e913b60a1f4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 5448, "upload_time": "2018-11-17T22:07:12", "url": "https://files.pythonhosted.org/packages/9a/59/98615244ae0bcdb31d94beb8b95e50dc07727462671f3458ef4f17666358/celluloid-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e960f4accf0881b6f8cbfaf993669dba", "sha256": "5cebd41276d9658f7667a2f1f565f566763a6110273b4af35c958b1407a9f277" }, "downloads": -1, "filename": "celluloid-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e960f4accf0881b6f8cbfaf993669dba", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5404, "upload_time": "2018-11-20T04:06:22", "url": "https://files.pythonhosted.org/packages/60/a7/7fbe80721c6f1b7370c4e50c77abe31b4d5cfeb58873d4d32f48ae5a0bae/celluloid-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "78da3ef8ff3944f253b16a923e427380", "sha256": "568b1512c4a97483759e9436c3f3e5dc5566da350179aa1872992ec8d82706e1" }, "downloads": -1, "filename": "celluloid-0.2.0.tar.gz", "has_sig": false, "md5_digest": "78da3ef8ff3944f253b16a923e427380", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 6442, "upload_time": "2018-11-20T04:06:27", "url": "https://files.pythonhosted.org/packages/0d/31/80e96c4b221de342eef55f1f07de84b11b5f7cfb8c3b00e235a0bdd0b476/celluloid-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e960f4accf0881b6f8cbfaf993669dba", "sha256": "5cebd41276d9658f7667a2f1f565f566763a6110273b4af35c958b1407a9f277" }, "downloads": -1, "filename": "celluloid-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e960f4accf0881b6f8cbfaf993669dba", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5404, "upload_time": "2018-11-20T04:06:22", "url": "https://files.pythonhosted.org/packages/60/a7/7fbe80721c6f1b7370c4e50c77abe31b4d5cfeb58873d4d32f48ae5a0bae/celluloid-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "78da3ef8ff3944f253b16a923e427380", "sha256": "568b1512c4a97483759e9436c3f3e5dc5566da350179aa1872992ec8d82706e1" }, "downloads": -1, "filename": "celluloid-0.2.0.tar.gz", "has_sig": false, "md5_digest": "78da3ef8ff3944f253b16a923e427380", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 6442, "upload_time": "2018-11-20T04:06:27", "url": "https://files.pythonhosted.org/packages/0d/31/80e96c4b221de342eef55f1f07de84b11b5f7cfb8c3b00e235a0bdd0b476/celluloid-0.2.0.tar.gz" } ] }