Skip to main content

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

  1. Get an instance of ramp4.

  2. Add image with matplotlib using the ‘add’ method.

  3. Render the video using the ‘render’ method.

  4. 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


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.0.tar.gz (1.8 kB view details)

Uploaded Source

File details

Details for the file ramp4-1.0.tar.gz.

File metadata

  • Download URL: ramp4-1.0.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

Hashes for ramp4-1.0.tar.gz
Algorithm Hash digest
SHA256 00072b0110613a9f1ca9634dd65f9d744f7af0e7d60770205721dd381c44e44c
MD5 940b32895ac7a1fd61ca4250b78236ae
BLAKE2b-256 ee46c418f48cc18d668ecb60e74c3444a2bb5bd0c683d7ca4bbb1f05c393b84c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page