gif


Namegif JSON
Version 22.11.0 PyPI version JSON
download
home_pagehttps://github.com/maxhumber/gif
SummaryThe matplotlib Animation Extension
upload_time2022-11-16 20:18:10
maintainer
docs_urlNone
authorMax Humber
requires_python>=3.9
licenseMIT
keywords gif gifs animation pil pillow matplotlib
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <img alt="gif" src="https://raw.githubusercontent.com/maxhumber/gif/master/images/logo.png" height="200px">
</div>
<div align="center">
  <a href="https://calver.org/"><img src="https://img.shields.io/badge/calver-YY.MM.MICRO-22bfda.svg"></a>
  <a href="https://pypi.org/project/gif/"><img src="https://img.shields.io/pypi/v/gif.svg"></a>
  <a href="https://pepy.tech/project/gif"><img alt="Downloads" src="https://pepy.tech/badge/gif/month"></a>
</div>

### About

The [matplotlib](https://matplotlib.org/) Animation Extension

### Install & Import

```sh
pip install gif
```

```python
import gif
```

### Quickstart

```python
import gif
from random import randint
from matplotlib import pyplot as plt

x = [randint(0, 100) for _ in range(100)]
y = [randint(0, 100) for _ in range(100)]

# (Optional) Set the dots per inch resolution to 300
gif.options.matplotlib["dpi"] = 300

# Decorate a plot function with @gif.frame
@gif.frame
def plot(i):
    xi = x[i*10:(i+1)*10]
    yi = y[i*10:(i+1)*10]
    plt.scatter(xi, yi)
    plt.xlim((0, 100))
    plt.ylim((0, 100))

# Construct "frames"
frames = [plot(i) for i in range(10)]

# Save "frames" to gif with a specified duration (milliseconds) between each frame
gif.save(frames, 'example.gif', duration=50)
```


### Examples

| [![arrival.gif](images/arrival.gif)](examples/arrival.py)    | [![hop.gif](images/hop.gif)](examples/hop.py)          | [![phone.gif](images/phone.gif)](examples/phone.py) |
| ------------------------------------------------------------ | ------------------------------------------------------ | --------------------------------------------------- |
| [![seinfeld.gif](images/seinfeld.gif)](examples/seinfeld.py) | [![spiral.gif](images/spiral.gif)](examples/spiral.py) | [![heart.gif](images/heart.gif)](heart.py)          |


### Warning

Altair and Plotly are no longer supported in `22.5.0`+

Please use `pip install gif==3.0.0` if you still need to interface with these libraries

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/maxhumber/gif",
    "name": "gif",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "gif,gifs,animation,PIL,pillow,matplotlib",
    "author": "Max Humber",
    "author_email": "max.humber@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8f/62/d0a51ba005c95896ef0b6a33fe97c8a58d19c9b9b5f6f79a65a9642bf6cc/gif-22.11.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <img alt=\"gif\" src=\"https://raw.githubusercontent.com/maxhumber/gif/master/images/logo.png\" height=\"200px\">\n</div>\n<div align=\"center\">\n  <a href=\"https://calver.org/\"><img src=\"https://img.shields.io/badge/calver-YY.MM.MICRO-22bfda.svg\"></a>\n  <a href=\"https://pypi.org/project/gif/\"><img src=\"https://img.shields.io/pypi/v/gif.svg\"></a>\n  <a href=\"https://pepy.tech/project/gif\"><img alt=\"Downloads\" src=\"https://pepy.tech/badge/gif/month\"></a>\n</div>\n\n### About\n\nThe [matplotlib](https://matplotlib.org/) Animation Extension\n\n### Install & Import\n\n```sh\npip install gif\n```\n\n```python\nimport gif\n```\n\n### Quickstart\n\n```python\nimport gif\nfrom random import randint\nfrom matplotlib import pyplot as plt\n\nx = [randint(0, 100) for _ in range(100)]\ny = [randint(0, 100) for _ in range(100)]\n\n# (Optional) Set the dots per inch resolution to 300\ngif.options.matplotlib[\"dpi\"] = 300\n\n# Decorate a plot function with @gif.frame\n@gif.frame\ndef plot(i):\n    xi = x[i*10:(i+1)*10]\n    yi = y[i*10:(i+1)*10]\n    plt.scatter(xi, yi)\n    plt.xlim((0, 100))\n    plt.ylim((0, 100))\n\n# Construct \"frames\"\nframes = [plot(i) for i in range(10)]\n\n# Save \"frames\" to gif with a specified duration (milliseconds) between each frame\ngif.save(frames, 'example.gif', duration=50)\n```\n\n\n### Examples\n\n| [![arrival.gif](images/arrival.gif)](examples/arrival.py)    | [![hop.gif](images/hop.gif)](examples/hop.py)          | [![phone.gif](images/phone.gif)](examples/phone.py) |\n| ------------------------------------------------------------ | ------------------------------------------------------ | --------------------------------------------------- |\n| [![seinfeld.gif](images/seinfeld.gif)](examples/seinfeld.py) | [![spiral.gif](images/spiral.gif)](examples/spiral.py) | [![heart.gif](images/heart.gif)](heart.py)          |\n\n\n### Warning\n\nAltair and Plotly are no longer supported in `22.5.0`+\n\nPlease use `pip install gif==3.0.0` if you still need to interface with these libraries\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The matplotlib Animation Extension",
    "version": "22.11.0",
    "split_keywords": [
        "gif",
        "gifs",
        "animation",
        "pil",
        "pillow",
        "matplotlib"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "0801d83598daaf0c729ddef95583b960",
                "sha256": "bf1980fa0696b6eb3cc61fb60d93af1a650a51b764fc6593adc8b193dfa352e6"
            },
            "downloads": -1,
            "filename": "gif-22.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0801d83598daaf0c729ddef95583b960",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 3821,
            "upload_time": "2022-11-16T20:18:08",
            "upload_time_iso_8601": "2022-11-16T20:18:08.954692Z",
            "url": "https://files.pythonhosted.org/packages/57/cd/48b370d9543f51fd4be03cb5a08d0701ba105d1619afd92b4de7d4f4c8a5/gif-22.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "1d3560b081767834bd3474c8f9956f07",
                "sha256": "ab37620cbf3b5cb1eb2cca0676577a96e030f0bfb1ff2dba06d85aaf383e2e44"
            },
            "downloads": -1,
            "filename": "gif-22.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1d3560b081767834bd3474c8f9956f07",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 3632,
            "upload_time": "2022-11-16T20:18:10",
            "upload_time_iso_8601": "2022-11-16T20:18:10.694888Z",
            "url": "https://files.pythonhosted.org/packages/8f/62/d0a51ba005c95896ef0b6a33fe97c8a58d19c9b9b5f6f79a65a9642bf6cc/gif-22.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-11-16 20:18:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "maxhumber",
    "github_project": "gif",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gif"
}
        
Elapsed time: 0.02140s