✨ Better animated Matplotlib gifs
Project description
About
gif
is a better way to build animated Matplotlib gifs.
Installation
pip install -U gif
Usage
gif
is easy to use. Just import:
import gif
from matplotlib import pyplot as plt
Decorate a Matplotlib plot function with gif.frame
:
@gif.frame
def plot(x, y):
plt.figure(figsize=(5, 5))
plt.scatter(x, y)
plt.xlim((0, 100))
plt.ylim((0, 100))
Build a bunch of "frames" with a standard for loop:
from random import randint
frames = []
for _ in range(50):
x = [randint(0, 100) for _ in range(10)]
y = [randint(0, 100) for _ in range(10)]
frame = plot(x, y)
frames.append(frame)
Select the duration (milliseconds) between each frame and save:
gif.save(frames, 'random.gif', duration=100)
Examples
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-1.0.1.tar.gz
(2.6 kB
view details)
File details
Details for the file gif-1.0.1.tar.gz
.
File metadata
- Download URL: gif-1.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67280c3a93e783258aa29ae038feabaf92031b5bab87f12e9f27978e087a2216 |
|
MD5 | bf87c9578aa2c4b3fae3b0ed2adb40e4 |
|
BLAKE2b-256 | e97f414ec50554a69c58228a73290f8eaaf9d5a271321c2089bfd90b72824e98 |