pyplotutil 2.0.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.
- pyplotutil/__init__.py +70 -0
- pyplotutil/_typing.py +38 -0
- pyplotutil/datautil.py +1295 -0
- pyplotutil/loggingutil.py +743 -0
- pyplotutil/plotutil.py +846 -0
- pyplotutil/py.typed +0 -0
- pyplotutil-2.0.0.dist-info/METADATA +123 -0
- pyplotutil-2.0.0.dist-info/RECORD +10 -0
- pyplotutil-2.0.0.dist-info/WHEEL +4 -0
- pyplotutil-2.0.0.dist-info/licenses/LICENSE +21 -0
pyplotutil/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyplotutil
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Python utilities for academic plotting
|
|
5
|
+
Project-URL: Homepage, https://github.com/hrshtst/pyplotutil
|
|
6
|
+
Author-email: Hiroshi Atsuta <atsuta@ieee.org>
|
|
7
|
+
Maintainer-email: Hiroshi Atsuta <atsuta@ieee.org>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: matplotlib-figures,matplotlib-style-sheets,matplotlib-styles,python,scientific-papers
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Framework :: Matplotlib
|
|
13
|
+
Classifier: Framework :: Pytest
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Requires-Dist: matplotlib>=3.10.0
|
|
29
|
+
Requires-Dist: numpy>=2.2.0
|
|
30
|
+
Requires-Dist: polars>=1.17.1
|
|
31
|
+
Requires-Dist: scienceplots>=2.1.1
|
|
32
|
+
Provides-Extra: gui
|
|
33
|
+
Requires-Dist: pyqt6>=6.8.0; extra == 'gui'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# pyplotutil: plotting utility for academic publications
|
|
37
|
+
|
|
38
|
+
**pyplotutil** is a wrapper library of
|
|
39
|
+
[polars](https://pola.rs/) and
|
|
40
|
+
[matplotlib](https://matplotlib.org/), which allows you to handle time
|
|
41
|
+
series data easily and create graphs tolerable to scientific
|
|
42
|
+
publications.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- Load tabular data from CSV files, buffers, or polars frames with
|
|
47
|
+
column-attribute access (`data.time`, `data.voltage`)
|
|
48
|
+
- Group rows by a tag column (`TaggedData`) or manage whole
|
|
49
|
+
directories of data files (`Dataset`)
|
|
50
|
+
- Plot multiple time series and mean-with-error graphs (standard
|
|
51
|
+
deviation, standard error, variance, range)
|
|
52
|
+
- Apply publication-ready matplotlib styles
|
|
53
|
+
([SciencePlots](https://github.com/garrettj403/SciencePlots)):
|
|
54
|
+
`science`, `ieee`, `nature`, `notebook`
|
|
55
|
+
- Save figures to multiple formats in one call with sanitized
|
|
56
|
+
filenames
|
|
57
|
+
- Event logging helpers with file and console output
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
Requires Python 3.11+.
|
|
62
|
+
|
|
63
|
+
```console
|
|
64
|
+
pip install git+https://github.com/hrshtst/pyplotutil.git
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Interactive plotting with `plt.show()` needs a GUI backend, which is
|
|
68
|
+
provided by the optional `gui` extra:
|
|
69
|
+
|
|
70
|
+
```console
|
|
71
|
+
pip install "pyplotutil[gui] @ git+https://github.com/hrshtst/pyplotutil.git"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quickstart
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import matplotlib.pyplot as plt
|
|
78
|
+
|
|
79
|
+
from pyplotutil import Data, Dataset, apply_style, plot_mean_err, save_figure
|
|
80
|
+
|
|
81
|
+
# Publication-ready style.
|
|
82
|
+
apply_style("science", no_latex=True)
|
|
83
|
+
|
|
84
|
+
# Load a single CSV file; columns are accessible as attributes.
|
|
85
|
+
data = Data("experiment.csv")
|
|
86
|
+
fig, ax = plt.subplots()
|
|
87
|
+
ax.plot(data.t, data.position)
|
|
88
|
+
|
|
89
|
+
# Load every CSV file in a directory and plot mean with standard error.
|
|
90
|
+
dataset = Dataset("results/")
|
|
91
|
+
t, y = dataset.get_timeseries("position")
|
|
92
|
+
plot_mean_err(ax, t, y, "se", tlim=None, lw=1, capsize=2, label="mean")
|
|
93
|
+
|
|
94
|
+
# Write figure.png and figure.pdf in one call.
|
|
95
|
+
save_figure(fig, "output", "figure", ["png", "pdf"])
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Group rows by a tag column:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from pyplotutil import TaggedData
|
|
102
|
+
|
|
103
|
+
tagged = TaggedData("trials.csv", tag_column="trial")
|
|
104
|
+
for tag, data in tagged:
|
|
105
|
+
print(tag, data.param("gain"))
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
This project uses [uv](https://docs.astral.sh/uv/) and
|
|
111
|
+
[nox](https://nox.thea.codes/):
|
|
112
|
+
|
|
113
|
+
```console
|
|
114
|
+
uv sync # set up the development environment
|
|
115
|
+
uv run pytest # run the test suite
|
|
116
|
+
uv run mypy # type check
|
|
117
|
+
uv run ruff check # lint
|
|
118
|
+
nox # lint + type check + tests on Python 3.11-3.14
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pyplotutil/__init__.py,sha256=Lyjk-DVSqmvUQRuq5DJi3uz7lb9sJkWwIXhR5AL8J48,1624
|
|
2
|
+
pyplotutil/_typing.py,sha256=i_YKJ1PrFyNzQSCB1R2UYhodO-2kahei5yvmTeXsWn8,1247
|
|
3
|
+
pyplotutil/datautil.py,sha256=aQalgM4VNTajL26SmxiuCTzq2bFmK_AY9LpRq1DQIHo,39012
|
|
4
|
+
pyplotutil/loggingutil.py,sha256=sS5DwhUeRK106oqIWT66KDgYYWTYlv0nIZ6AIKkTIuQ,19939
|
|
5
|
+
pyplotutil/plotutil.py,sha256=WsVVobxbNTJlObPW7fC8b2eTO3S1nWEqGvXLFGUiUQ4,25655
|
|
6
|
+
pyplotutil/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
pyplotutil-2.0.0.dist-info/METADATA,sha256=uPfubB5Tifn6rg2J0TDpjGNO0mUHPTOcSjQA_2fzHa0,3856
|
|
8
|
+
pyplotutil-2.0.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
9
|
+
pyplotutil-2.0.0.dist-info/licenses/LICENSE,sha256=FmHEqjEFDPIJyBNdklwwLSCjxGsQSTgpsl46nDsqLsY,1071
|
|
10
|
+
pyplotutil-2.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Hiroshi Atsuta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|