uplot-python 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- uplot/__init__.py +1 -3
- uplot/color_picker.py +0 -2
- uplot/exceptions.py +0 -2
- uplot/generate_html.py +1 -2
- uplot/plot.py +4 -3
- uplot/plot2.py +6 -1
- uplot/utils.py +9 -8
- uplot/write_html_tempfile.py +0 -2
- {uplot_python-1.0.0.dist-info → uplot_python-1.1.0.dist-info}/METADATA +14 -11
- uplot_python-1.1.0.dist-info/RECORD +16 -0
- {uplot_python-1.0.0.dist-info → uplot_python-1.1.0.dist-info}/WHEEL +1 -1
- uplot_python-1.0.0.dist-info/RECORD +0 -16
- {uplot_python-1.0.0.dist-info → uplot_python-1.1.0.dist-info/licenses}/LICENSE +0 -0
uplot/__init__.py
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
# Copyright 2022 Stéphane Caron
|
|
6
|
-
# Copyright 2023-2024 Inria
|
|
7
5
|
|
|
8
6
|
"""Python wrapper for μPlot time series."""
|
|
9
7
|
|
|
10
|
-
__version__ = "1.
|
|
8
|
+
__version__ = "1.1.0"
|
|
11
9
|
|
|
12
10
|
from .plot import plot
|
|
13
11
|
from .plot2 import plot2
|
uplot/color_picker.py
CHANGED
uplot/exceptions.py
CHANGED
uplot/generate_html.py
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
# Copyright 2022 Stéphane Caron
|
|
6
|
-
# Copyright 2023 Inria
|
|
7
5
|
|
|
8
6
|
"""Generate an HTML page containing the output plot."""
|
|
9
7
|
|
|
@@ -23,6 +21,7 @@ def generate_html(opts: dict, data: List[np.ndarray], resize: bool) -> str:
|
|
|
23
21
|
Args:
|
|
24
22
|
opts: uPlot option dictionary.
|
|
25
23
|
data: List of NumPy arrays, one for each series in the plot.
|
|
24
|
+
resize: If set, add a resize event listener to fit the window.
|
|
26
25
|
|
|
27
26
|
Returns:
|
|
28
27
|
HTML contents of the page.
|
uplot/plot.py
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
# Copyright 2024 Inria
|
|
6
5
|
|
|
7
6
|
"""Main plot function."""
|
|
8
7
|
|
|
9
8
|
import webbrowser
|
|
10
|
-
from typing import
|
|
9
|
+
from typing import List
|
|
10
|
+
|
|
11
|
+
import numpy as np
|
|
11
12
|
|
|
12
13
|
from .generate_html import generate_html
|
|
13
14
|
from .write_html_tempfile import write_html_tempfile
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
def plot(opts: dict, data: List[
|
|
17
|
+
def plot(opts: dict, data: List[np.ndarray]) -> None:
|
|
17
18
|
"""Plot function with the same API as uPlot's `plot`.
|
|
18
19
|
|
|
19
20
|
Args:
|
uplot/plot2.py
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
# Copyright 2024 Inria
|
|
6
5
|
|
|
7
6
|
"""Additional plot function."""
|
|
8
7
|
|
|
@@ -19,6 +18,7 @@ from .write_html_tempfile import write_html_tempfile
|
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
def prepare_data(x, left, right):
|
|
21
|
+
"""Combine x, left-axis, and right-axis arrays into a flat data list."""
|
|
22
22
|
if isinstance(left, np.ndarray) and left.ndim == 1:
|
|
23
23
|
left = [left]
|
|
24
24
|
data = [x, *left]
|
|
@@ -28,6 +28,7 @@ def prepare_data(x, left, right):
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def add_default_options(opts: dict) -> None:
|
|
31
|
+
"""Populate cursor drag and wheel-zoom plugin defaults when absent."""
|
|
31
32
|
if "cursor" not in opts:
|
|
32
33
|
opts["cursor"] = {
|
|
33
34
|
"drag": {
|
|
@@ -49,6 +50,7 @@ def add_series(
|
|
|
49
50
|
left_labels: Optional[List[str]],
|
|
50
51
|
right_labels: Optional[List[str]],
|
|
51
52
|
) -> None:
|
|
53
|
+
"""Build the uPlot series list and attach it to opts."""
|
|
52
54
|
if left_labels is not None and len(left_labels) < nb_left:
|
|
53
55
|
raise UplotException(
|
|
54
56
|
f"Not enough labels in left_labels ({len(left_labels)}) "
|
|
@@ -95,6 +97,7 @@ def add_series(
|
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
def add_axes(opts: dict) -> None:
|
|
100
|
+
"""Add default left and right axis definitions to opts."""
|
|
98
101
|
opts["axes"] = [
|
|
99
102
|
{},
|
|
100
103
|
{
|
|
@@ -133,6 +136,8 @@ def plot2(
|
|
|
133
136
|
timestamped: If set, x-axis values are treated as timestamps.
|
|
134
137
|
width: Plot width in pixels.
|
|
135
138
|
height: Plot height in pixels.
|
|
139
|
+
left_labels: Labels for the left-axis series, in order.
|
|
140
|
+
right_labels: Labels for the right-axis series, in order.
|
|
136
141
|
kwargs: Other keyword arguments are forward to uPlot as options.
|
|
137
142
|
"""
|
|
138
143
|
data = prepare_data(x, left, right)
|
uplot/utils.py
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
#
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
"""Array and JavaScript code utilities."""
|
|
7
|
+
|
|
8
|
+
import json
|
|
6
9
|
|
|
7
10
|
import numpy as np
|
|
8
11
|
|
|
@@ -16,13 +19,11 @@ def array2string(array: np.ndarray) -> str:
|
|
|
16
19
|
Returns:
|
|
17
20
|
String representation of the array.
|
|
18
21
|
"""
|
|
19
|
-
|
|
20
|
-
array
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
return array_str.replace("nan", "null")
|
|
22
|
+
if array.dtype.kind in "iu":
|
|
23
|
+
return json.dumps(array.tolist())
|
|
24
|
+
# tolist() unboxes to Python floats; ``v != v`` is true only for NaN.
|
|
25
|
+
values = array.tolist()
|
|
26
|
+
return json.dumps([None if v != v else v for v in values])
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
def js(code: str) -> str:
|
uplot/write_html_tempfile.py
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: uplot-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Python wrapper for μPlot time series.
|
|
5
5
|
Keywords: json,time,series,plot
|
|
6
6
|
Author-email: Stéphane Caron <stephane.caron@normalesup.org>
|
|
7
7
|
Maintainer-email: Stéphane Caron <stephane.caron@normalesup.org>
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
-
Classifier: Development Status ::
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
17
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
18
|
+
License-File: LICENSE
|
|
20
19
|
Requires-Dist: ipython >=8.0.1
|
|
21
20
|
Requires-Dist: msgpack >=1.0.4
|
|
22
21
|
Requires-Dist: numpy >=1.15.4
|
|
23
|
-
Project-URL: Changelog, https://
|
|
24
|
-
Project-URL: Homepage, https://
|
|
25
|
-
Project-URL: Source, https://
|
|
26
|
-
Project-URL: Tracker, https://
|
|
22
|
+
Project-URL: Changelog, https://codeberg.org/stephane-caron/uplot-python/blob/master/CHANGELOG.md
|
|
23
|
+
Project-URL: Homepage, https://codeberg.org/stephane-caron/uplot-python
|
|
24
|
+
Project-URL: Source, https://codeberg.org/stephane-caron/uplot-python
|
|
25
|
+
Project-URL: Tracker, https://codeberg.org/stephane-caron/uplot-python/issues
|
|
27
26
|
|
|
28
27
|
# uplot-python
|
|
29
28
|
|
|
29
|
+
[](https://ci.codeberg.org/repos/17009)
|
|
30
|
+
[](https://anaconda.org/conda-forge/uplot-python)
|
|
31
|
+
[](https://pypi.org/project/uplot-python/)
|
|
32
|
+
|
|
30
33
|
Python wrapper for [μPlot](https://github.com/leeoniya/uPlot) 📈
|
|
31
34
|
|
|
32
35
|
## Installation
|
|
@@ -76,5 +79,5 @@ uplot.plot2(
|
|
|
76
79
|
|
|
77
80
|
- [µPlot](https://github.com/leeoniya/uPlot): A small (~45 KB min), fast chart for time series, lines, areas, ohlc & bars.
|
|
78
81
|
- [Matplotlib](https://matplotlib.org/stable/): Comprehensive library for creating static, animated, and interactive visualizations.
|
|
79
|
-
- [matplotlive](https://
|
|
82
|
+
- [matplotlive](https://codeberg.org/stephane-caron/matplotlive): Stream live plots to a Matplotlib figure.
|
|
80
83
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
uplot/__init__.py,sha256=FRPhRJ7xLuJLzle7fMRkAKoDbTzapOw5HxwJHkYBTMY,245
|
|
2
|
+
uplot/color_picker.py,sha256=FdA7Jd6mMungX9UuvJ9syYjvCcQJ9--LdxTBj-te0v8,901
|
|
3
|
+
uplot/exceptions.py,sha256=8_2xggNkMpMF-pRsfA8kLWT81l_t2cZ4cfOkwbPql_4,192
|
|
4
|
+
uplot/generate_html.py,sha256=NruX2zDzzTIOuJW4lQ6N60kg05MAH61eWEAijcFKhr0,3713
|
|
5
|
+
uplot/plot.py,sha256=MOGxCDlYdH-n6f380_3wmYCdfjwtU438AtcFYZ4gdiQ,643
|
|
6
|
+
uplot/plot2.py,sha256=P5tOyZxsm65mG1DN3TSK2q4qWBOk2GJPBcWx0xXz9Ks,4887
|
|
7
|
+
uplot/utils.py,sha256=Tl6ZDtMdtE27PuX3Vje_IQjhZZg40BcfmlXcU02o_Nc,880
|
|
8
|
+
uplot/write_html_tempfile.py,sha256=B68PrF3rQ3mC3i6ujKgHy8cf8V64h4D9DxIqkGdLRQI,661
|
|
9
|
+
uplot/static/__init__.py,sha256=1mykIjCDK2TC5EfbjCTNxfOtJx3P-hIFgbHQEtBfM_o,71
|
|
10
|
+
uplot/static/uPlot.iife.js,sha256=ZVvIqjN4Hochxa9rWfFpnAPJvalRqnSmq1GKwgzEMm0,120184
|
|
11
|
+
uplot/static/uPlot.min.css,sha256=PxIc1KmXtjTgeoh2WIUAGOR1wm8L3dh0EJqNOCwZ3oc,1839
|
|
12
|
+
uplot/static/uPlot.mousewheel.js,sha256=p2CcCwxxafvNqXsxw-zrqUUogxZ1URZhxWK59B0-tgw,4543
|
|
13
|
+
uplot_python-1.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
14
|
+
uplot_python-1.1.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
15
|
+
uplot_python-1.1.0.dist-info/METADATA,sha256=IUFfatQ54RV4rz5-L8r3Y1jEZtMfxFP4G_M7oKdHBk0,2812
|
|
16
|
+
uplot_python-1.1.0.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
uplot/__init__.py,sha256=cNNmW1r6MVagQ85Otp-Ms55B63KoVTutayVYDDt4Q40,306
|
|
2
|
-
uplot/color_picker.py,sha256=tBcc4t1gN2spSBqmy7gY827GvpzPE2u8N8-6xUMv-YY,962
|
|
3
|
-
uplot/exceptions.py,sha256=iMQrMn8yzcU95-g0vL1Lg03M5FB8vo4ckJpZXEb0TyE,248
|
|
4
|
-
uplot/generate_html.py,sha256=CiwaJZtIShSNAufidH74OCzdJB-7lrm9-f4MDi_AR60,3698
|
|
5
|
-
uplot/plot.py,sha256=GugDtmx2nqcxmwZ20LEbaX06lX0Swvncb9-136tTXqM,654
|
|
6
|
-
uplot/plot2.py,sha256=PmEsGyBEFD0vvvfvD5LYah-hV2Lp48saviqhkGqtWDE,4504
|
|
7
|
-
uplot/utils.py,sha256=0cuQ8XWcDCm0hFvhtUHtt2OeLWf6ujwfSvKokTxuiCQ,775
|
|
8
|
-
uplot/write_html_tempfile.py,sha256=gYbp-btAItW4CX1Wjt2ufhcptdlA0ckFK-xFXA92tGw,722
|
|
9
|
-
uplot/static/__init__.py,sha256=1mykIjCDK2TC5EfbjCTNxfOtJx3P-hIFgbHQEtBfM_o,71
|
|
10
|
-
uplot/static/uPlot.iife.js,sha256=ZVvIqjN4Hochxa9rWfFpnAPJvalRqnSmq1GKwgzEMm0,120184
|
|
11
|
-
uplot/static/uPlot.min.css,sha256=PxIc1KmXtjTgeoh2WIUAGOR1wm8L3dh0EJqNOCwZ3oc,1839
|
|
12
|
-
uplot/static/uPlot.mousewheel.js,sha256=p2CcCwxxafvNqXsxw-zrqUUogxZ1URZhxWK59B0-tgw,4543
|
|
13
|
-
uplot_python-1.0.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
14
|
-
uplot_python-1.0.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
15
|
-
uplot_python-1.0.0.dist-info/METADATA,sha256=b9XQy0hZ17t7ks58s_wIYSOGBDqGwNJHGSIEHAOAh4g,2537
|
|
16
|
-
uplot_python-1.0.0.dist-info/RECORD,,
|
|
File without changes
|