Metadata-Version: 2.4
Name: pmecg
Version: 0.2.3
Summary: Plot ECGs on a paper-like support. Flexible to variable configurations.
Project-URL: Homepage, https://github.com/bonassifabio/pmecg
Project-URL: Repository, https://github.com/bonassifabio/pmecg
Project-URL: Issues, https://github.com/bonassifabio/pmecg/issues
Author-email: Fabio Bonassi <fabio.bonassi@polimi.it>
License: GPL-3.0-or-later
License-File: LICENSE
Keywords: cardiology,ecg,electrocardiogram,plot,signal
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: matplotlib>=3.7
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Description-Content-Type: text/markdown

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg"/>
    <img src="assets/logo.svg" alt="pmecg logo" width="333"/>
  </picture>
</p>

# pmecg — Plot My ECG

[![PyPI](https://img.shields.io/pypi/v/pmecg)](https://pypi.org/project/pmecg/)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Python](https://img.shields.io/pypi/pyversions/pmecg)](https://pypi.org/project/pmecg/)

**pmecg** is a Python library for plotting ECG signals on a paper-like support, with flexible lead configurations, time scales, and attention map overlays.

| 1×3 layout | 4×3 layout |
|:---:|:---:|
| ![1x3 ECG](example/artifacts/no-attention/1/1x3.png) | ![4x3 ECG](example/artifacts/no-attention/1/4x3.png) |

| Interval attention | Line-color attention | Background attention |
|:---:|:---:|:---:|
| ![Interval attention ECG](example/artifacts/attention/4x3-interval-signed.png) | ![Line-color attention ECG](example/artifacts/attention/4x3-line-color-signed.png) | ![Background attention ECG](example/artifacts/attention/4x3-background-signed.png) |

## Installation

```bash
pip install pmecg
```

## Quick start

```python
import numpy as np
import pandas as pd
import pmecg

fs = 500
t = np.linspace(0, 10, int(fs * 10))
df = pd.DataFrame({name: np.random.randn(len(t)) * 0.1 for name in pmecg.SUPPORTED_LEADS})

plotter = pmecg.ECGPlotter()
configuration = pmecg.template_factory("4x3", df, leads_map=None)
fig = plotter.plot(df, configuration=configuration, sampling_frequency=fs)
fig.savefig("ecg.png", dpi=300, bbox_inches="tight")
```

For full documentation, visit [pmecg.readthedocs.io](https://pmecg.readthedocs.io/en/stable/).

## License

Copyright (C) 2026 Fabio Bonassi — [GNU General Public License v3](LICENSE)
