Skip to content

fccoelho/liveplots

Repository files navigation

liveplots

CI PyPI Python License Ruff Code style: Ruff

Real-time live plot server using ZeroMQ and Gnuplot.

Description

liveplots serves a minimalistic plotting API over ZeroMQ. Plot commands are sent fire-and-forget via PUSH/PULL sockets — the calling process is never blocked waiting for a response. Plots are generated by Gnuplot.

The purpose of this package is to monitor long-running computations without interfering with them (i.e. slowing them down).

Multiple plot servers can be started, each on its own daemon process.

Requirements

  • Python 3.12+
  • Gnuplot (install via apt install gnuplot on Debian/Ubuntu, brew install gnuplot on macOS)

Installation

uv add liveplots

Or with pip:

pip install liveplots

Quick Start

from numpy import random
from liveplots import PlotServer

pserver = PlotServer(port=0, persist=1)

data = random.normal(0, 1, 1000).tolist()
data2 = random.normal(4, 1, 1000).tolist()

pserver.lines([data, data2], [], ["data", "data2"], "Two plots")
pserver.flush_queue()

More examples in the examples/ directory.

Plot Gallery

Lines Scatter Histogram
Lines Scatter Histogram
Error Bars Filled Curves Boxplot
Error Bars Filled Curves Boxplot
Heatmap Multiplot
Heatmap Multiplot

File System Monitor

The package also includes a cross-platform file system monitor based on watchdog:

from liveplots import Monitor

def action(fpath):
    print(f"File changed: {fpath}")

monitor = Monitor("/tmp", ["create", "modify"], action)

License

GPL-3.0-or-later

About

This is a python package which serves a (so far very minimalistic) plotting API through a xmlrpc server. The plots are generated by Gnuplot.

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages