The matplotlib Animation Extension
Project description
About
The matplotlib Animation Extension
Quickstart
Install
pip install gif
Usage
import random
from matplotlib import pyplot as plt
import gif
x = [random.randint(0, 100) for _ in range(100)]
y = [random.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 (return not required):
@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))
# Build a bunch of "frames"
frames = []
for i in range(10):
frame = plot(i)
frames.append(frame)
# Specify the duration between frames (milliseconds) and save to file:
gif.save(frames, 'example.gif', duration=50)
Examples
⚠️ Warning
Altair and Plotly are no longer supported in 4.0
+
Please use pip install gif==3.0.0
if you still need to interface with these libraries
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gif-4.0rc1.tar.gz
(3.6 kB
view details)
Built Distribution
gif-4.0rc1-py3-none-any.whl
(3.8 kB
view details)
File details
Details for the file gif-4.0rc1.tar.gz
.
File metadata
- Download URL: gif-4.0rc1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02f1645c2926c703d3c1e2bddcbb0942683f3bdacf2663b5016aa703ef463553 |
|
MD5 | 05f0a840a30f29105d0abee69ef46df1 |
|
BLAKE2b-256 | fd4cf54e43ad08ec833c0dc51f57b4ff826bd95cd91d6e1794628c52a75188db |
File details
Details for the file gif-4.0rc1-py3-none-any.whl
.
File metadata
- Download URL: gif-4.0rc1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdc7a1ed6f82812367885b83ff06226d10a2a88b113e3b3b5729d12af40a92b7 |
|
MD5 | d55387992d07b2248193e7a0ad4ebd5d |
|
BLAKE2b-256 | 56cba55794aaebe3ae952c06f313fba4ce7c770abf0b770339bb447e13a7b659 |