figrecipe 0.5.0__py3-none-any.whl → 0.6.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.
- figrecipe/__init__.py +361 -93
- figrecipe/_dev/__init__.py +120 -0
- figrecipe/_dev/demo_plotters/__init__.py +195 -0
- figrecipe/_dev/demo_plotters/plot_acorr.py +24 -0
- figrecipe/_dev/demo_plotters/plot_angle_spectrum.py +28 -0
- figrecipe/_dev/demo_plotters/plot_bar.py +25 -0
- figrecipe/_dev/demo_plotters/plot_barbs.py +30 -0
- figrecipe/_dev/demo_plotters/plot_barh.py +25 -0
- figrecipe/_dev/demo_plotters/plot_boxplot.py +24 -0
- figrecipe/_dev/demo_plotters/plot_cohere.py +29 -0
- figrecipe/_dev/demo_plotters/plot_contour.py +30 -0
- figrecipe/_dev/demo_plotters/plot_contourf.py +29 -0
- figrecipe/_dev/demo_plotters/plot_csd.py +29 -0
- figrecipe/_dev/demo_plotters/plot_ecdf.py +24 -0
- figrecipe/_dev/demo_plotters/plot_errorbar.py +28 -0
- figrecipe/_dev/demo_plotters/plot_eventplot.py +25 -0
- figrecipe/_dev/demo_plotters/plot_fill.py +29 -0
- figrecipe/_dev/demo_plotters/plot_fill_between.py +30 -0
- figrecipe/_dev/demo_plotters/plot_fill_betweenx.py +28 -0
- figrecipe/_dev/demo_plotters/plot_hexbin.py +25 -0
- figrecipe/_dev/demo_plotters/plot_hist.py +24 -0
- figrecipe/_dev/demo_plotters/plot_hist2d.py +25 -0
- figrecipe/_dev/demo_plotters/plot_imshow.py +23 -0
- figrecipe/_dev/demo_plotters/plot_loglog.py +27 -0
- figrecipe/_dev/demo_plotters/plot_magnitude_spectrum.py +28 -0
- figrecipe/_dev/demo_plotters/plot_matshow.py +23 -0
- figrecipe/_dev/demo_plotters/plot_pcolor.py +29 -0
- figrecipe/_dev/demo_plotters/plot_pcolormesh.py +29 -0
- figrecipe/_dev/demo_plotters/plot_phase_spectrum.py +28 -0
- figrecipe/_dev/demo_plotters/plot_pie.py +23 -0
- figrecipe/_dev/demo_plotters/plot_plot.py +27 -0
- figrecipe/_dev/demo_plotters/plot_psd.py +29 -0
- figrecipe/_dev/demo_plotters/plot_quiver.py +30 -0
- figrecipe/_dev/demo_plotters/plot_scatter.py +24 -0
- figrecipe/_dev/demo_plotters/plot_semilogx.py +27 -0
- figrecipe/_dev/demo_plotters/plot_semilogy.py +27 -0
- figrecipe/_dev/demo_plotters/plot_specgram.py +30 -0
- figrecipe/_dev/demo_plotters/plot_spy.py +29 -0
- figrecipe/_dev/demo_plotters/plot_stackplot.py +29 -0
- figrecipe/_dev/demo_plotters/plot_stairs.py +27 -0
- figrecipe/_dev/demo_plotters/plot_stem.py +27 -0
- figrecipe/_dev/demo_plotters/plot_step.py +27 -0
- figrecipe/_dev/demo_plotters/plot_streamplot.py +30 -0
- figrecipe/_dev/demo_plotters/plot_tricontour.py +28 -0
- figrecipe/_dev/demo_plotters/plot_tricontourf.py +28 -0
- figrecipe/_dev/demo_plotters/plot_tripcolor.py +29 -0
- figrecipe/_dev/demo_plotters/plot_triplot.py +25 -0
- figrecipe/_dev/demo_plotters/plot_violinplot.py +25 -0
- figrecipe/_dev/demo_plotters/plot_xcorr.py +25 -0
- figrecipe/_editor/__init__.py +230 -0
- figrecipe/_editor/_bbox.py +978 -0
- figrecipe/_editor/_flask_app.py +1229 -0
- figrecipe/_editor/_hitmap.py +937 -0
- figrecipe/_editor/_overrides.py +318 -0
- figrecipe/_editor/_renderer.py +349 -0
- figrecipe/_editor/_templates/__init__.py +75 -0
- figrecipe/_editor/_templates/_html.py +406 -0
- figrecipe/_editor/_templates/_scripts.py +2778 -0
- figrecipe/_editor/_templates/_styles.py +1326 -0
- figrecipe/_params/_DECORATION_METHODS.py +27 -0
- figrecipe/_params/_PLOTTING_METHODS.py +58 -0
- figrecipe/_params/__init__.py +9 -0
- figrecipe/_recorder.py +126 -73
- figrecipe/_reproducer.py +658 -41
- figrecipe/_seaborn.py +14 -9
- figrecipe/_serializer.py +2 -2
- figrecipe/_signatures/README.md +68 -0
- figrecipe/_signatures/__init__.py +12 -2
- figrecipe/_signatures/_loader.py +515 -56
- figrecipe/_utils/__init__.py +6 -4
- figrecipe/_utils/_crop.py +10 -4
- figrecipe/_utils/_image_diff.py +37 -33
- figrecipe/_utils/_numpy_io.py +0 -1
- figrecipe/_utils/_units.py +11 -3
- figrecipe/_validator.py +12 -3
- figrecipe/_wrappers/_axes.py +860 -46
- figrecipe/_wrappers/_figure.py +115 -18
- figrecipe/plt.py +0 -1
- figrecipe/pyplot.py +2 -1
- figrecipe/styles/__init__.py +9 -10
- figrecipe/styles/_style_applier.py +332 -28
- figrecipe/styles/_style_loader.py +172 -44
- figrecipe/styles/presets/MATPLOTLIB.yaml +94 -0
- figrecipe/styles/presets/SCITEX.yaml +176 -0
- figrecipe-0.6.0.dist-info/METADATA +394 -0
- figrecipe-0.6.0.dist-info/RECORD +90 -0
- figrecipe-0.5.0.dist-info/METADATA +0 -336
- figrecipe-0.5.0.dist-info/RECORD +0 -26
- {figrecipe-0.5.0.dist-info → figrecipe-0.6.0.dist-info}/WHEEL +0 -0
- {figrecipe-0.5.0.dist-info → figrecipe-0.6.0.dist-info}/licenses/LICENSE +0 -0
figrecipe/_seaborn.py
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
"""Seaborn wrapper for figrecipe recording."""
|
|
4
4
|
|
|
5
5
|
from functools import wraps
|
|
6
|
-
from typing import Any, Callable, Dict,
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
|
|
10
10
|
try:
|
|
11
|
-
import seaborn as sns
|
|
12
11
|
import pandas as pd
|
|
12
|
+
import seaborn as sns
|
|
13
|
+
|
|
13
14
|
HAS_SEABORN = True
|
|
14
15
|
except ImportError:
|
|
15
16
|
HAS_SEABORN = False
|
|
@@ -17,7 +18,7 @@ except ImportError:
|
|
|
17
18
|
pd = None
|
|
18
19
|
|
|
19
20
|
if TYPE_CHECKING:
|
|
20
|
-
|
|
21
|
+
pass
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
# Seaborn axes-level plotting functions to wrap
|
|
@@ -91,8 +92,15 @@ def _extract_data_from_dataframe(
|
|
|
91
92
|
|
|
92
93
|
# All column parameters
|
|
93
94
|
param_values = [
|
|
94
|
-
("x", x),
|
|
95
|
-
("
|
|
95
|
+
("x", x),
|
|
96
|
+
("y", y),
|
|
97
|
+
("hue", hue),
|
|
98
|
+
("size", size),
|
|
99
|
+
("style", style),
|
|
100
|
+
("row", row),
|
|
101
|
+
("col", col),
|
|
102
|
+
("weight", weight),
|
|
103
|
+
("weights", weights),
|
|
96
104
|
]
|
|
97
105
|
|
|
98
106
|
for param_name, col_name in param_values:
|
|
@@ -200,10 +208,7 @@ def _is_serializable(value: Any) -> bool:
|
|
|
200
208
|
if isinstance(value, (list, tuple)):
|
|
201
209
|
return all(_is_serializable(v) for v in value)
|
|
202
210
|
if isinstance(value, dict):
|
|
203
|
-
return all(
|
|
204
|
-
isinstance(k, str) and _is_serializable(v)
|
|
205
|
-
for k, v in value.items()
|
|
206
|
-
)
|
|
211
|
+
return all(isinstance(k, str) and _is_serializable(v) for k, v in value.items())
|
|
207
212
|
return False
|
|
208
213
|
|
|
209
214
|
|
figrecipe/_serializer.py
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"""Serialization for recipe files (YAML + data files)."""
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Any, Dict,
|
|
6
|
+
from typing import Any, Dict, Union
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
9
9
|
from ruamel.yaml import YAML
|
|
10
10
|
|
|
11
11
|
from ._recorder import FigureRecord
|
|
12
|
-
from ._utils._numpy_io import
|
|
12
|
+
from ._utils._numpy_io import DataFormat, load_array, save_array
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def _convert_numpy_types(obj: Any) -> Any:
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!-- ---
|
|
2
|
+
!-- Timestamp: 2025-12-23 10:52:06
|
|
3
|
+
!-- Author: ywatanabe
|
|
4
|
+
!-- File: /home/ywatanabe/proj/figrecipe/src/figrecipe/_signatures/README.md
|
|
5
|
+
!-- --- -->
|
|
6
|
+
|
|
7
|
+
``` python
|
|
8
|
+
from figrecipe._signatures._loader import list_plotting_methods
|
|
9
|
+
|
|
10
|
+
print(list_plotting_methods())
|
|
11
|
+
# [
|
|
12
|
+
# 'acorr',
|
|
13
|
+
# 'angle_spectrum',
|
|
14
|
+
# 'bar',
|
|
15
|
+
# 'barbs',
|
|
16
|
+
# 'barh',
|
|
17
|
+
# 'boxplot',
|
|
18
|
+
# 'cohere',
|
|
19
|
+
# 'contour',
|
|
20
|
+
# 'contourf',
|
|
21
|
+
# 'csd',
|
|
22
|
+
# 'ecdf',
|
|
23
|
+
# 'errorbar',
|
|
24
|
+
# 'eventplot',
|
|
25
|
+
# 'fill',
|
|
26
|
+
# 'fill_between',
|
|
27
|
+
# 'fill_betweenx',
|
|
28
|
+
# 'hexbin',
|
|
29
|
+
# 'hist',
|
|
30
|
+
# 'hist2d',
|
|
31
|
+
# 'imshow',
|
|
32
|
+
# 'loglog',
|
|
33
|
+
# 'magnitude_spectrum',
|
|
34
|
+
# 'matshow',
|
|
35
|
+
# 'pcolor',
|
|
36
|
+
# 'pcolormesh',
|
|
37
|
+
# 'phase_spectrum',
|
|
38
|
+
# 'pie',
|
|
39
|
+
# 'plot',
|
|
40
|
+
# 'psd',
|
|
41
|
+
# 'quiver',
|
|
42
|
+
# 'scatter',
|
|
43
|
+
# 'semilogx',
|
|
44
|
+
# 'semilogy',
|
|
45
|
+
# 'specgram',
|
|
46
|
+
# 'spy',
|
|
47
|
+
# 'stackplot',
|
|
48
|
+
# 'stairs',
|
|
49
|
+
# 'stem',
|
|
50
|
+
# 'step',
|
|
51
|
+
# 'streamplot',
|
|
52
|
+
# 'tricontour',
|
|
53
|
+
# 'tricontourf',
|
|
54
|
+
# 'tripcolor',
|
|
55
|
+
# 'triplot',
|
|
56
|
+
# 'violinplot',
|
|
57
|
+
# 'xcorr'
|
|
58
|
+
# ]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
from figrecipe._signatures._loader import get_signature
|
|
62
|
+
# Signature: get_signature(method_name: str) -> Dict[str, Any]
|
|
63
|
+
|
|
64
|
+
get_signature("plot")
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<!-- EOF -->
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
"""Matplotlib function signatures for validation and defaults."""
|
|
4
4
|
|
|
5
|
-
from ._loader import
|
|
5
|
+
from ._loader import (
|
|
6
|
+
get_defaults,
|
|
7
|
+
get_signature,
|
|
8
|
+
list_plotting_methods,
|
|
9
|
+
validate_kwargs,
|
|
10
|
+
)
|
|
6
11
|
|
|
7
|
-
__all__ = [
|
|
12
|
+
__all__ = [
|
|
13
|
+
"get_signature",
|
|
14
|
+
"get_defaults",
|
|
15
|
+
"validate_kwargs",
|
|
16
|
+
"list_plotting_methods",
|
|
17
|
+
]
|