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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ramp4-1.2.tar.gz.
File metadata
- Download URL: ramp4-1.2.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 |
0ee4b9eff35fd42e2e5beeb61b75d93d72049b89587efd9fe6ca7994dba76d73
|
|
| MD5 |
e2a72fd2a27fd221760a5778882c57c8
|
|
| BLAKE2b-256 |
8221fa89bed8d0609ec44f624ea01d10ae155545aee95647c456fa8168e157c7
|
File details
Details for the file ramp4-1.2-py3-none-any.whl.
File metadata
- Download URL: ramp4-1.2-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- 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 |
e2575968a3dbf5eaeca093de15b28639e775df6dfef159950eb4846988ad7a1c
|
|
| MD5 |
fe7823075a53f2bcb8a9294335ea8518
|
|
| BLAKE2b-256 |
e7b937321d30954c58bd6530ffd995ba599535e2e4639b0977705b65fec876b2
|