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.
Files changed (90) hide show
  1. figrecipe/__init__.py +361 -93
  2. figrecipe/_dev/__init__.py +120 -0
  3. figrecipe/_dev/demo_plotters/__init__.py +195 -0
  4. figrecipe/_dev/demo_plotters/plot_acorr.py +24 -0
  5. figrecipe/_dev/demo_plotters/plot_angle_spectrum.py +28 -0
  6. figrecipe/_dev/demo_plotters/plot_bar.py +25 -0
  7. figrecipe/_dev/demo_plotters/plot_barbs.py +30 -0
  8. figrecipe/_dev/demo_plotters/plot_barh.py +25 -0
  9. figrecipe/_dev/demo_plotters/plot_boxplot.py +24 -0
  10. figrecipe/_dev/demo_plotters/plot_cohere.py +29 -0
  11. figrecipe/_dev/demo_plotters/plot_contour.py +30 -0
  12. figrecipe/_dev/demo_plotters/plot_contourf.py +29 -0
  13. figrecipe/_dev/demo_plotters/plot_csd.py +29 -0
  14. figrecipe/_dev/demo_plotters/plot_ecdf.py +24 -0
  15. figrecipe/_dev/demo_plotters/plot_errorbar.py +28 -0
  16. figrecipe/_dev/demo_plotters/plot_eventplot.py +25 -0
  17. figrecipe/_dev/demo_plotters/plot_fill.py +29 -0
  18. figrecipe/_dev/demo_plotters/plot_fill_between.py +30 -0
  19. figrecipe/_dev/demo_plotters/plot_fill_betweenx.py +28 -0
  20. figrecipe/_dev/demo_plotters/plot_hexbin.py +25 -0
  21. figrecipe/_dev/demo_plotters/plot_hist.py +24 -0
  22. figrecipe/_dev/demo_plotters/plot_hist2d.py +25 -0
  23. figrecipe/_dev/demo_plotters/plot_imshow.py +23 -0
  24. figrecipe/_dev/demo_plotters/plot_loglog.py +27 -0
  25. figrecipe/_dev/demo_plotters/plot_magnitude_spectrum.py +28 -0
  26. figrecipe/_dev/demo_plotters/plot_matshow.py +23 -0
  27. figrecipe/_dev/demo_plotters/plot_pcolor.py +29 -0
  28. figrecipe/_dev/demo_plotters/plot_pcolormesh.py +29 -0
  29. figrecipe/_dev/demo_plotters/plot_phase_spectrum.py +28 -0
  30. figrecipe/_dev/demo_plotters/plot_pie.py +23 -0
  31. figrecipe/_dev/demo_plotters/plot_plot.py +27 -0
  32. figrecipe/_dev/demo_plotters/plot_psd.py +29 -0
  33. figrecipe/_dev/demo_plotters/plot_quiver.py +30 -0
  34. figrecipe/_dev/demo_plotters/plot_scatter.py +24 -0
  35. figrecipe/_dev/demo_plotters/plot_semilogx.py +27 -0
  36. figrecipe/_dev/demo_plotters/plot_semilogy.py +27 -0
  37. figrecipe/_dev/demo_plotters/plot_specgram.py +30 -0
  38. figrecipe/_dev/demo_plotters/plot_spy.py +29 -0
  39. figrecipe/_dev/demo_plotters/plot_stackplot.py +29 -0
  40. figrecipe/_dev/demo_plotters/plot_stairs.py +27 -0
  41. figrecipe/_dev/demo_plotters/plot_stem.py +27 -0
  42. figrecipe/_dev/demo_plotters/plot_step.py +27 -0
  43. figrecipe/_dev/demo_plotters/plot_streamplot.py +30 -0
  44. figrecipe/_dev/demo_plotters/plot_tricontour.py +28 -0
  45. figrecipe/_dev/demo_plotters/plot_tricontourf.py +28 -0
  46. figrecipe/_dev/demo_plotters/plot_tripcolor.py +29 -0
  47. figrecipe/_dev/demo_plotters/plot_triplot.py +25 -0
  48. figrecipe/_dev/demo_plotters/plot_violinplot.py +25 -0
  49. figrecipe/_dev/demo_plotters/plot_xcorr.py +25 -0
  50. figrecipe/_editor/__init__.py +230 -0
  51. figrecipe/_editor/_bbox.py +978 -0
  52. figrecipe/_editor/_flask_app.py +1229 -0
  53. figrecipe/_editor/_hitmap.py +937 -0
  54. figrecipe/_editor/_overrides.py +318 -0
  55. figrecipe/_editor/_renderer.py +349 -0
  56. figrecipe/_editor/_templates/__init__.py +75 -0
  57. figrecipe/_editor/_templates/_html.py +406 -0
  58. figrecipe/_editor/_templates/_scripts.py +2778 -0
  59. figrecipe/_editor/_templates/_styles.py +1326 -0
  60. figrecipe/_params/_DECORATION_METHODS.py +27 -0
  61. figrecipe/_params/_PLOTTING_METHODS.py +58 -0
  62. figrecipe/_params/__init__.py +9 -0
  63. figrecipe/_recorder.py +126 -73
  64. figrecipe/_reproducer.py +658 -41
  65. figrecipe/_seaborn.py +14 -9
  66. figrecipe/_serializer.py +2 -2
  67. figrecipe/_signatures/README.md +68 -0
  68. figrecipe/_signatures/__init__.py +12 -2
  69. figrecipe/_signatures/_loader.py +515 -56
  70. figrecipe/_utils/__init__.py +6 -4
  71. figrecipe/_utils/_crop.py +10 -4
  72. figrecipe/_utils/_image_diff.py +37 -33
  73. figrecipe/_utils/_numpy_io.py +0 -1
  74. figrecipe/_utils/_units.py +11 -3
  75. figrecipe/_validator.py +12 -3
  76. figrecipe/_wrappers/_axes.py +860 -46
  77. figrecipe/_wrappers/_figure.py +115 -18
  78. figrecipe/plt.py +0 -1
  79. figrecipe/pyplot.py +2 -1
  80. figrecipe/styles/__init__.py +9 -10
  81. figrecipe/styles/_style_applier.py +332 -28
  82. figrecipe/styles/_style_loader.py +172 -44
  83. figrecipe/styles/presets/MATPLOTLIB.yaml +94 -0
  84. figrecipe/styles/presets/SCITEX.yaml +176 -0
  85. figrecipe-0.6.0.dist-info/METADATA +394 -0
  86. figrecipe-0.6.0.dist-info/RECORD +90 -0
  87. figrecipe-0.5.0.dist-info/METADATA +0 -336
  88. figrecipe-0.5.0.dist-info/RECORD +0 -26
  89. {figrecipe-0.5.0.dist-info → figrecipe-0.6.0.dist-info}/WHEEL +0 -0
  90. {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, List, Optional, TYPE_CHECKING
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
- from ._wrappers._axes import RecordingAxes
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), ("y", y), ("hue", hue), ("size", size), ("style", style),
95
- ("row", row), ("col", col), ("weight", weight), ("weights", weights),
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, Literal, Optional, Union
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 save_array, load_array, DataFormat
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 get_signature, get_defaults, validate_kwargs
5
+ from ._loader import (
6
+ get_defaults,
7
+ get_signature,
8
+ list_plotting_methods,
9
+ validate_kwargs,
10
+ )
6
11
 
7
- __all__ = ["get_signature", "get_defaults", "validate_kwargs"]
12
+ __all__ = [
13
+ "get_signature",
14
+ "get_defaults",
15
+ "validate_kwargs",
16
+ "list_plotting_methods",
17
+ ]