Skip to main content

The matplotlib Animation Extension

Project description

gif
Downloads

About

The matplotlib Animation Extension

Install & Import

pip install gif
import gif

Quickstart

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 hop.gif phone.gif
seinfeld.gif spiral.gif heart.gif

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gif-22.11.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gif-22.11.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file gif-22.11.0.tar.gz.

File metadata

  • Download URL: gif-22.11.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for gif-22.11.0.tar.gz
Algorithm Hash digest
SHA256 ab37620cbf3b5cb1eb2cca0676577a96e030f0bfb1ff2dba06d85aaf383e2e44
MD5 1d3560b081767834bd3474c8f9956f07
BLAKE2b-256 8f62d0a51ba005c95896ef0b6a33fe97c8a58d19c9b9b5f6f79a65a9642bf6cc

See more details on using hashes here.

File details

Details for the file gif-22.11.0-py3-none-any.whl.

File metadata

  • Download URL: gif-22.11.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for gif-22.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf1980fa0696b6eb3cc61fb60d93af1a650a51b764fc6593adc8b193dfa352e6
MD5 0801d83598daaf0c729ddef95583b960
BLAKE2b-256 57cd48b370d9543f51fd4be03cb5a08d0701ba105d1619afd92b4de7d4f4c8a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page