scitex 2.3.0__py3-none-any.whl → 2.4.1__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.
- scitex/ai/classification/reporters/reporter_utils/_Plotter.py +1 -1
- scitex/ai/plt/__init__.py +2 -2
- scitex/ai/plt/{_plot_conf_mat.py → _stx_conf_mat.py} +3 -3
- scitex/config/PriorityConfig.py +195 -0
- scitex/config/__init__.py +24 -0
- scitex/io/_save.py +125 -34
- scitex/io/_save_modules/_image.py +37 -20
- scitex/plt/__init__.py +470 -17
- scitex/plt/_subplots/_AxisWrapper.py +98 -50
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin.py +559 -124
- scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin.py +49 -8
- scitex/plt/_subplots/_SubplotsWrapper.py +76 -91
- scitex/plt/_subplots/_export_as_csv.py +127 -58
- scitex/plt/_subplots/_export_as_csv_formatters/__init__.py +25 -16
- scitex/plt/_subplots/_export_as_csv_formatters/_format_contourf.py +54 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_hexbin.py +41 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_hist2d.py +41 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_imshow.py +59 -47
- scitex/plt/_subplots/_export_as_csv_formatters/_format_matshow.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_pie.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_plot.py +72 -35
- scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_box.py +1 -1
- scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_kde.py +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/_format_quiver.py +53 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_stem.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_step.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_streamplot.py +48 -0
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_conf_mat.py → _format_stx_conf_mat.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_ecdf.py → _format_stx_ecdf.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_fillv.py → _format_stx_fillv.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_heatmap.py → _format_stx_heatmap.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_image.py → _format_stx_image.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_joyplot.py → _format_stx_joyplot.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_line.py → _format_stx_line.py} +3 -3
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_ci.py → _format_stx_mean_ci.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_std.py → _format_stx_mean_std.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_median_iqr.py → _format_stx_median_iqr.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_raster.py → _format_stx_raster.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_rectangle.py → _format_stx_rectangle.py} +1 -1
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_scatter_hist.py → _format_stx_scatter_hist.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_shaded_line.py → _format_stx_shaded_line.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_violin.py → _format_stx_violin.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/verify_formatters.py +23 -23
- scitex/plt/ax/__init__.py +16 -15
- scitex/plt/ax/_plot/__init__.py +30 -30
- scitex/plt/ax/_plot/_add_fitted_line.py +65 -11
- scitex/plt/ax/_plot/_plot_statistical_shaded_line.py +104 -76
- scitex/plt/ax/_plot/{_plot_conf_mat.py → _stx_conf_mat.py} +10 -10
- scitex/plt/ax/_plot/_stx_ecdf.py +109 -0
- scitex/plt/ax/_plot/{_plot_fillv.py → _stx_fillv.py} +7 -7
- scitex/plt/ax/_plot/_stx_heatmap.py +366 -0
- scitex/plt/ax/_plot/{_plot_image.py → _stx_image.py} +1 -1
- scitex/plt/ax/_plot/_stx_joyplot.py +113 -0
- scitex/plt/ax/_plot/{_plot_raster.py → _stx_raster.py} +37 -25
- scitex/plt/ax/_plot/{_plot_rectangle.py → _stx_rectangle.py} +10 -9
- scitex/plt/ax/_plot/{_plot_scatter_hist.py → _stx_scatter_hist.py} +1 -1
- scitex/plt/ax/_plot/_stx_shaded_line.py +215 -0
- scitex/plt/ax/_plot/{_plot_violin.py → _stx_violin.py} +13 -6
- scitex/plt/ax/_style/__init__.py +3 -0
- scitex/plt/ax/_style/_style_barplot.py +13 -2
- scitex/plt/ax/_style/_style_boxplot.py +78 -32
- scitex/plt/ax/_style/_style_errorbar.py +17 -3
- scitex/plt/ax/_style/_style_scatter.py +17 -3
- scitex/plt/ax/_style/_style_violinplot.py +109 -0
- scitex/plt/color/_vizualize_colors.py +3 -3
- scitex/plt/styles/SCITEX_STYLE.yaml +104 -0
- scitex/plt/styles/__init__.py +57 -0
- scitex/plt/styles/_plot_defaults.py +209 -0
- scitex/plt/styles/_plot_postprocess.py +518 -0
- scitex/plt/styles/_style_loader.py +268 -0
- scitex/plt/styles/presets.py +208 -0
- scitex/plt/utils/_collect_figure_metadata.py +160 -18
- scitex/plt/utils/_colorbar.py +72 -10
- scitex/plt/utils/_configure_mpl.py +108 -52
- scitex/plt/utils/_crop.py +21 -7
- scitex/plt/utils/_figure_mm.py +21 -7
- scitex/stats/__init__.py +13 -1
- scitex/stats/_schema.py +578 -0
- scitex/stats/tests/__init__.py +13 -0
- scitex/stats/tests/correlation/__init__.py +13 -0
- scitex/stats/tests/correlation/_test_pearson.py +262 -0
- scitex/vis/__init__.py +6 -0
- scitex/vis/editor/__init__.py +23 -0
- scitex/vis/editor/_defaults.py +205 -0
- scitex/vis/editor/_edit.py +342 -0
- scitex/vis/editor/_mpl_editor.py +231 -0
- scitex/vis/editor/_tkinter_editor.py +466 -0
- scitex/vis/editor/_web_editor.py +1440 -0
- scitex/vis/model/plot_types.py +15 -15
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/METADATA +2 -1
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/RECORD +94 -67
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/WHEEL +1 -1
- scitex/plt/ax/_plot/_plot_ecdf.py +0 -84
- scitex/plt/ax/_plot/_plot_heatmap.py +0 -277
- scitex/plt/ax/_plot/_plot_joyplot.py +0 -77
- scitex/plt/ax/_plot/_plot_shaded_line.py +0 -142
- scitex/plt/presets.py +0 -224
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/entry_points.txt +0 -0
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
|
-
# Timestamp: "2025-
|
|
4
|
-
# File: /home/ywatanabe/proj/
|
|
3
|
+
# Timestamp: "2025-12-01 10:00:00 (ywatanabe)"
|
|
4
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_AxisWrapper.py
|
|
5
5
|
# ----------------------------------------
|
|
6
6
|
import os
|
|
7
7
|
|
|
@@ -21,6 +21,7 @@ from ._AxisWrapperMixins import (
|
|
|
21
21
|
TrackingMixin,
|
|
22
22
|
UnitAwareMixin,
|
|
23
23
|
)
|
|
24
|
+
from scitex.plt.styles import apply_plot_defaults, apply_plot_postprocess
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class AxisWrapper(MatplotlibPlotMixin, SeabornMixin, AdjustmentMixin, TrackingMixin, UnitAwareMixin):
|
|
@@ -51,6 +52,7 @@ class AxisWrapper(MatplotlibPlotMixin, SeabornMixin, AdjustmentMixin, TrackingMi
|
|
|
51
52
|
self.track = track
|
|
52
53
|
self.id = 0
|
|
53
54
|
self._counter_part = matplotlib.axes.Axes
|
|
55
|
+
self._tracking_depth = 0 # Depth counter to prevent tracking internal calls
|
|
54
56
|
|
|
55
57
|
# Initialize unit awareness
|
|
56
58
|
UnitAwareMixin.__init__(self)
|
|
@@ -93,57 +95,103 @@ class AxisWrapper(MatplotlibPlotMixin, SeabornMixin, AdjustmentMixin, TrackingMi
|
|
|
93
95
|
if callable(orig_attr):
|
|
94
96
|
|
|
95
97
|
@wraps(orig_attr)
|
|
96
|
-
def wrapper(*args, **kwargs):
|
|
98
|
+
def wrapper(*args, __method_name__=name, **kwargs):
|
|
97
99
|
id_value = kwargs.pop("id", None)
|
|
98
100
|
track_override = kwargs.pop("track", None)
|
|
99
101
|
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
#
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
#
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
102
|
+
# Increment tracking depth to detect internal calls
|
|
103
|
+
# Internal calls (depth > 1) won't be tracked
|
|
104
|
+
self._tracking_depth += 1
|
|
105
|
+
is_top_level_call = (self._tracking_depth == 1)
|
|
106
|
+
|
|
107
|
+
try:
|
|
108
|
+
# Apply pre-processing defaults from styles module
|
|
109
|
+
apply_plot_defaults(__method_name__, kwargs, id_value, self._axes_mpl)
|
|
110
|
+
|
|
111
|
+
# Pop scitex-specific kwargs before calling matplotlib
|
|
112
|
+
# These are handled in post-processing
|
|
113
|
+
scitex_kwargs = {}
|
|
114
|
+
if __method_name__ == 'violinplot':
|
|
115
|
+
scitex_kwargs['boxplot'] = kwargs.pop('boxplot', True)
|
|
116
|
+
|
|
117
|
+
# Call the original matplotlib method
|
|
118
|
+
result = orig_attr(*args, **kwargs)
|
|
119
|
+
|
|
120
|
+
# Store the scitex id on the result for later retrieval
|
|
121
|
+
# This is used by _collect_figure_metadata to map traces to CSV columns
|
|
122
|
+
if id_value is not None:
|
|
123
|
+
if isinstance(result, list):
|
|
124
|
+
# plot() returns list of Line2D objects
|
|
125
|
+
for item in result:
|
|
126
|
+
item._scitex_id = id_value
|
|
127
|
+
elif hasattr(result, '__iter__') and not isinstance(result, str):
|
|
128
|
+
# Other containers (e.g., bar containers)
|
|
129
|
+
try:
|
|
130
|
+
for item in result:
|
|
131
|
+
item._scitex_id = id_value
|
|
132
|
+
except (TypeError, AttributeError):
|
|
133
|
+
pass
|
|
134
|
+
else:
|
|
135
|
+
# Single object
|
|
136
|
+
try:
|
|
137
|
+
result._scitex_id = id_value
|
|
138
|
+
except AttributeError:
|
|
139
|
+
pass
|
|
140
|
+
|
|
141
|
+
# Restore scitex kwargs for post-processing
|
|
142
|
+
kwargs.update(scitex_kwargs)
|
|
143
|
+
|
|
144
|
+
# Apply post-processing styling from styles module
|
|
145
|
+
apply_plot_postprocess(__method_name__, result, self._axes_mpl, kwargs, args)
|
|
146
|
+
|
|
147
|
+
# Determine if tracking should occur
|
|
148
|
+
# Only track top-level calls (depth == 1), not internal matplotlib calls
|
|
149
|
+
should_track = (
|
|
150
|
+
track_override if track_override is not None else self.track
|
|
151
|
+
) and is_top_level_call
|
|
152
|
+
|
|
153
|
+
# Track the method call if tracking enabled
|
|
154
|
+
# Expanded list of matplotlib plotting methods to track
|
|
155
|
+
tracking_methods = {
|
|
156
|
+
# Basic plots
|
|
157
|
+
'plot', 'scatter', 'bar', 'barh', 'hist', 'boxplot', 'violinplot',
|
|
158
|
+
# Line plots
|
|
159
|
+
'fill_between', 'fill_betweenx', 'errorbar', 'step', 'stem',
|
|
160
|
+
# Statistical plots
|
|
161
|
+
'hist2d', 'hexbin', 'pie',
|
|
162
|
+
# Contour plots
|
|
163
|
+
'contour', 'contourf', 'tricontour', 'tricontourf',
|
|
164
|
+
# Image plots
|
|
165
|
+
'imshow', 'matshow', 'spy',
|
|
166
|
+
# Quiver plots
|
|
167
|
+
'quiver', 'streamplot',
|
|
168
|
+
# 3D-related (if axes3d)
|
|
169
|
+
'plot3D', 'scatter3D', 'bar3d', 'plot_surface', 'plot_wireframe',
|
|
170
|
+
# Text and annotations (data-containing)
|
|
171
|
+
'annotate', 'text'
|
|
172
|
+
}
|
|
173
|
+
if should_track and __method_name__ in tracking_methods:
|
|
174
|
+
# Use the _track method from TrackingMixin
|
|
175
|
+
# If no id provided, it will auto-generate one
|
|
176
|
+
try:
|
|
177
|
+
# Convert args to tracked_dict for consistency with other tracking
|
|
178
|
+
tracked_dict = {"args": args}
|
|
179
|
+
self._track(
|
|
180
|
+
should_track, id_value, __method_name__, tracked_dict, kwargs
|
|
181
|
+
)
|
|
182
|
+
except AttributeError:
|
|
183
|
+
warnings.warn(
|
|
184
|
+
f"Tracking setup incomplete for AxisWrapper ({__method_name__}).",
|
|
185
|
+
UserWarning,
|
|
186
|
+
stacklevel=2,
|
|
187
|
+
)
|
|
188
|
+
except Exception as e:
|
|
189
|
+
# Silently continue if tracking fails to not break plotting
|
|
190
|
+
pass
|
|
191
|
+
return result # Return the result of the original call
|
|
192
|
+
finally:
|
|
193
|
+
# Always decrement depth, even if exception occurs
|
|
194
|
+
self._tracking_depth -= 1
|
|
147
195
|
|
|
148
196
|
return wrapper
|
|
149
197
|
else:
|