A simple library to make mp4 movies with matplotlib.pyplot. It use RAM instead of disk storage for the temporary images.
Project description
INTRODUCTION
A simple library to make mp4 movies with matplotlib.pyplot. It use RAM instead of disk storage for the temporary images.
INSTALLATION
pip install ramp4
GET STARTED
Get an instance of ramp4.
Add image with matplotlib using the ‘add’ method.
Render the video using the ‘render’ method.
Done
EXAMPLE 1
import numpy as np
import matplotlib.pyplot as plt
from ramp4 import ramp4
X = np.linspace(0, 5, 250)
movie = ramp4()
for i in np.linspace(0, 3.14, 200):
plt.plot(X, np.cos(X+i))
plt.xlim(0, 5)
plt.ylim(-1, 1)
plt.xlabel("x")
plt.ylabel("cos(x+t)")
movie.add(dpi=200)
plt.close()
movie.render(outfile="video_example_2a.mp4", fps=50, close=False)
movie.render(outfile="video_example_2b.mp4", fps=100)
EXAMPLE 2
import numpy as np
import matplotlib.pyplot as plt
from ramp4 import ramp4
X = np.linspace(0, 5, 250)
movie = ramp4()
for i in np.linspace(0, 3.14, 200):
fig, ax = plt.subplots(1, 1)
ax.plot(X, np.sin(X+i))
ax.set_xlim(0, 5)
ax.set_ylim(-1, 1)
ax.set_xlabel("x")
ax.set_ylabel("sin(x+t)")
movie.add(fig=fig, dpi=200)
plt.close(fig=fig)
movie.render(outfile="video_example1.mp4", fps=50)
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
ramp4-1.1.tar.gz
(1.8 kB
view details)
File details
Details for the file ramp4-1.1.tar.gz.
File metadata
- Download URL: ramp4-1.1.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e69c0989bcd32f4547dce46b91bbb35aa74b03e040ed24c8fcf58d6a99991bae
|
|
| MD5 |
7bbf153dfa6dd9cf649a990e6683d75b
|
|
| BLAKE2b-256 |
870bdfe581d41e0caa5e9162426d81607aad01ae74be3f53cd04e86903d13032
|