Skip to main content

Record and replay every step of your plotting process

Project description

snaplot: Record and replay every step of your plotting process

snaplot logo

snaplot is a Python package here to help your record your plotting process, without having to think about it!

It's highly inspired by {camcorder}, an R package that does pretty much the same thing. If you're an R user, check it out!



Why?

By nature, data visualization is an iterative process: no one creates the final, perfectly polished version of a graph on the first try. It always takes plenty of trial and error.

Interestingly, visualizing this process can be quite insightful. That's where snaplot comes in.



How to use?

snaplot provides a single class (Camera) and is designed to be as easy-to-use as possible.

import matplotlib.pyplot as plt
from snaplot import Camera

camera = Camera.start("my_movie")

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3])                       # first chart
camera.snap()

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 2, 3], color="red")          # second chart
camera.snap()

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 5, 3], color="green", lw=3)  # third chart
camera.snap()

fig, ax = plt.subplots()
ax.plot([5, 2, 4], [2, 3, 3], color="blue", lw=6)   # fourth chart
camera.snap()

# GIF with 4 images, 300ms/image
camera.stop("my_file.gif", frame_duration=300)

In short:

  • you initiate a camera with camera = Camera.start()
  • you take snapshots with camera.snap()
  • you save your video with camera.stop()

For more info, check out the reference page



Installation

pip install snaplot



Some cool things

  • You can run Camera.start() multiple times with the same id without forgetting previous camera.snap(). Unless you set force_new=True, it will automatically recognize that you're still recording.
  • Even after calling camera.stop("file.gif"), you can keep recording. If you want to save the intermediate GIF, just use a different filename like camera.stop("file2.gif").
  • It works with any matplotlib-based plotting library: seaborn, plotnine, etc

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

snaplot-0.2.2.tar.gz (23.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snaplot-0.2.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file snaplot-0.2.2.tar.gz.

File metadata

  • Download URL: snaplot-0.2.2.tar.gz
  • Upload date:
  • Size: 23.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for snaplot-0.2.2.tar.gz
Algorithm Hash digest
SHA256 178111e1f64696e13a02a9cdc8871de750b1e61fe4b94926a0eea23a5426ac0f
MD5 418743dc0fdb2329bac260677e1c223c
BLAKE2b-256 e9aa5b4ee46864ee8069556e387cef14a35f5bdf3446f25a964b623521e41359

See more details on using hashes here.

Provenance

The following attestation bundles were made for snaplot-0.2.2.tar.gz:

Publisher: pypi.yaml on y-sunflower/snaplot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file snaplot-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: snaplot-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for snaplot-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92333afa1dff75b450c1a348d0e8a765f9276542243d7cd6785c89b56b8509cd
MD5 5b162966be5911dfad795d066335913b
BLAKE2b-256 bab904690f1e7d135e8b6bdaa5687ef73c8a32be26b185b22f02b3ff8ba96a6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for snaplot-0.2.2-py3-none-any.whl:

Publisher: pypi.yaml on y-sunflower/snaplot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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