Skip to main content

Animation of matplotlib images

Project description

Build Status PyPI version Updates Python3 Cover

Helper functions to make animations of images with corresponding traces and labels using matplotlib

Example uses:

If you have a 3d movie (time, x, y):

from Animate.Movie import Movie
import numpy as np
m = Movie(dt=1.0 / 14, height_ratio=1.5)
img = np.random.randint(10, size=(40, 5, 5))
m.add_image(img, style='dark_img')
m.add_axis(x_label='time (s)', y_label='value')
m.add_trace(img.mean(axis=(1, 2)))'path/to/file/with_name', fps=1)

If you have a 2d movie (x, y) where you want to have a sliding window movie:

import numpy as np
from Animate.Movie import Movie

# prepare data
x_len = 300
x_res = 20.0
y_amplitude = 20
noise_amplitude = 5
x = np.arange(x_len) / x_res
y = np.sin(x) * y_amplitude
pix_number = 10
img = np.random.randint(0, noise_amplitude, size=pix_number*x_len).reshape(pix_number, x_len) + y

# make a movie
rate = 5.0
m = Movie(dt=1.0/rate)
m.add_image(img, animation_type='window', window_size=19, window_step=5)
m.add_axis('Time (s)', 'Mean value')
m.add_trace(img.mean(axis=0))'testing', fps=rate)


pytest --pep8 --cov=Animate --cov-report html


bumpversion patch
python sdist
twine upload \dist\...

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

animateimages-0.2.4.tar.gz (14.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page