https://github.com/stephane-caron/uplot-python
Python wrapper for μPlot 📈
https://github.com/stephane-caron/uplot-python
Last synced: about 1 month ago
JSON representation
Python wrapper for μPlot 📈
- Host: GitHub
- URL: https://github.com/stephane-caron/uplot-python
- Owner: stephane-caron
- License: apache-2.0
- Created: 2024-10-29T10:30:15.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-29T16:58:35.000Z (7 months ago)
- Last Synced: 2024-10-30T11:25:07.207Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# uplot-python
Python wrapper for [μPlot](https://github.com/leeoniya/uPlot) 📈
## Installation
### From conda-forge
```console
conda install -c conda-forge uplot-python
```### From PyPI
```console
pip install uplot-python
```## Usage
The `plot` function has the same API as µPlot's `uPlot.plot`:
```py
import numpy as np
import uplott = np.linspace(0.0, 1.0, 10)
data = [t, np.exp(0.42 * t)] # list of NumPy arrays
opts = {
"width": 1920,
"height": 600,
"title": "Example with uplot.plot",
"series": [{}, { "stroke": "red", }, ],
}uplot.plot(opts, data)
```For convenience, the library also provides a `plot2` function with additional defaults aimed at time series and line plots, for an experience closer to `matplotlib.pyplot.plot`:
```py
import numpy as np
import uplott = np.linspace(0.0, 1.0, 10)
uplot.plot2(
t,
[np.exp(0.1 * t), np.exp(-10.0 * t), np.cos(t)],
title="Example with uplot.plot2",
left_labels=["exp(A t)", "exp(-B t)", "cos(t)"],
)
```## See also
- [µPlot](https://github.com/leeoniya/uPlot): A small (~45 KB min), fast chart for time series, lines, areas, ohlc & bars.
- [Matplotlib](https://matplotlib.org/stable/): Comprehensive library for creating static, animated, and interactive visualizations.
- [matplotlive](https://github.com/stephane-caron/matplotlive): Stream live plots to a Matplotlib figure.