Metadata-Version: 2.4
Name: liveplots
Version: 2.0.1
Summary: Real-time live plot server using ZeroMQ and Gnuplot
Project-URL: Homepage, https://github.com/fccoelho/liveplots
Project-URL: Repository, https://github.com/fccoelho/liveplots
Project-URL: Issues, https://github.com/fccoelho/liveplots/issues
Author-email: Flávio Codeço Coelho <fccoelho@gmail.com>
License-Expression: GPL-3.0-or-later
License-File: LICENSE
Keywords: gnuplot,monitoring,plotting,real-time,zeromq,zmq
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.12
Requires-Dist: numpy>=1.26
Requires-Dist: pyzmq>=25.0
Requires-Dist: watchdog>=4.0
Provides-Extra: dev
Requires-Dist: mkdocs-material>=9.5; extra == 'dev'
Requires-Dist: mkdocs>=1.6; extra == 'dev'
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'dev'
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# liveplots

[![CI](https://github.com/fccoelho/liveplots/actions/workflows/ci.yml/badge.svg)](https://github.com/fccoelho/liveplots/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/liveplots)](https://pypi.org/project/liveplots/)
[![Python](https://img.shields.io/pypi/pyversions/liveplots)](https://pypi.org/project/liveplots/)
[![License](https://img.shields.io/pypi/l/liveplots)](https://www.gnu.org/licenses/gpl-3.0.html)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-2666e6)](https://github.com/astral-sh/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](http://www.gnuplot.info/).

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

```bash
uv add liveplots
```

Or with pip:

```bash
pip install liveplots
```

## Quick Start

```python
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/`](examples/) directory.

## Plot Gallery

| Lines | Scatter | Histogram |
|:---:|:---:|:---:|
| ![Lines](docs/images/lines.png) | ![Scatter](docs/images/scatter.png) | ![Histogram](docs/images/histogram.png) |

| Error Bars | Filled Curves | Boxplot |
|:---:|:---:|:---:|
| ![Error Bars](docs/images/error_bars.png) | ![Filled Curves](docs/images/filled_curves.png) | ![Boxplot](docs/images/boxplot.png) |

| Heatmap | Multiplot |
|:---:|:---:|
| ![Heatmap](docs/images/heatmap.png) | ![Multiplot](docs/images/multiplot.png) |

## File System Monitor

The package also includes a cross-platform file system monitor based on
[watchdog](https://python-watchdog.readthedocs.io/):

```python
from liveplots import Monitor

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

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

## License

GPL-3.0-or-later
