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.
Files changed (99) hide show
  1. scitex/ai/classification/reporters/reporter_utils/_Plotter.py +1 -1
  2. scitex/ai/plt/__init__.py +2 -2
  3. scitex/ai/plt/{_plot_conf_mat.py → _stx_conf_mat.py} +3 -3
  4. scitex/config/PriorityConfig.py +195 -0
  5. scitex/config/__init__.py +24 -0
  6. scitex/io/_save.py +125 -34
  7. scitex/io/_save_modules/_image.py +37 -20
  8. scitex/plt/__init__.py +470 -17
  9. scitex/plt/_subplots/_AxisWrapper.py +98 -50
  10. scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin.py +559 -124
  11. scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin.py +49 -8
  12. scitex/plt/_subplots/_SubplotsWrapper.py +76 -91
  13. scitex/plt/_subplots/_export_as_csv.py +127 -58
  14. scitex/plt/_subplots/_export_as_csv_formatters/__init__.py +25 -16
  15. scitex/plt/_subplots/_export_as_csv_formatters/_format_contourf.py +54 -0
  16. scitex/plt/_subplots/_export_as_csv_formatters/_format_hexbin.py +41 -0
  17. scitex/plt/_subplots/_export_as_csv_formatters/_format_hist2d.py +41 -0
  18. scitex/plt/_subplots/_export_as_csv_formatters/_format_imshow.py +59 -47
  19. scitex/plt/_subplots/_export_as_csv_formatters/_format_matshow.py +42 -0
  20. scitex/plt/_subplots/_export_as_csv_formatters/_format_pie.py +42 -0
  21. scitex/plt/_subplots/_export_as_csv_formatters/_format_plot.py +72 -35
  22. scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_box.py +1 -1
  23. scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_kde.py +2 -2
  24. scitex/plt/_subplots/_export_as_csv_formatters/_format_quiver.py +53 -0
  25. scitex/plt/_subplots/_export_as_csv_formatters/_format_stem.py +42 -0
  26. scitex/plt/_subplots/_export_as_csv_formatters/_format_step.py +42 -0
  27. scitex/plt/_subplots/_export_as_csv_formatters/_format_streamplot.py +48 -0
  28. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_conf_mat.py → _format_stx_conf_mat.py} +2 -2
  29. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_ecdf.py → _format_stx_ecdf.py} +2 -2
  30. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_fillv.py → _format_stx_fillv.py} +2 -2
  31. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_heatmap.py → _format_stx_heatmap.py} +2 -2
  32. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_image.py → _format_stx_image.py} +2 -2
  33. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_joyplot.py → _format_stx_joyplot.py} +2 -2
  34. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_line.py → _format_stx_line.py} +3 -3
  35. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_ci.py → _format_stx_mean_ci.py} +2 -2
  36. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_std.py → _format_stx_mean_std.py} +2 -2
  37. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_median_iqr.py → _format_stx_median_iqr.py} +2 -2
  38. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_raster.py → _format_stx_raster.py} +2 -2
  39. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_rectangle.py → _format_stx_rectangle.py} +1 -1
  40. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_scatter_hist.py → _format_stx_scatter_hist.py} +2 -2
  41. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_shaded_line.py → _format_stx_shaded_line.py} +2 -2
  42. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_violin.py → _format_stx_violin.py} +2 -2
  43. scitex/plt/_subplots/_export_as_csv_formatters/verify_formatters.py +23 -23
  44. scitex/plt/ax/__init__.py +16 -15
  45. scitex/plt/ax/_plot/__init__.py +30 -30
  46. scitex/plt/ax/_plot/_add_fitted_line.py +65 -11
  47. scitex/plt/ax/_plot/_plot_statistical_shaded_line.py +104 -76
  48. scitex/plt/ax/_plot/{_plot_conf_mat.py → _stx_conf_mat.py} +10 -10
  49. scitex/plt/ax/_plot/_stx_ecdf.py +109 -0
  50. scitex/plt/ax/_plot/{_plot_fillv.py → _stx_fillv.py} +7 -7
  51. scitex/plt/ax/_plot/_stx_heatmap.py +366 -0
  52. scitex/plt/ax/_plot/{_plot_image.py → _stx_image.py} +1 -1
  53. scitex/plt/ax/_plot/_stx_joyplot.py +113 -0
  54. scitex/plt/ax/_plot/{_plot_raster.py → _stx_raster.py} +37 -25
  55. scitex/plt/ax/_plot/{_plot_rectangle.py → _stx_rectangle.py} +10 -9
  56. scitex/plt/ax/_plot/{_plot_scatter_hist.py → _stx_scatter_hist.py} +1 -1
  57. scitex/plt/ax/_plot/_stx_shaded_line.py +215 -0
  58. scitex/plt/ax/_plot/{_plot_violin.py → _stx_violin.py} +13 -6
  59. scitex/plt/ax/_style/__init__.py +3 -0
  60. scitex/plt/ax/_style/_style_barplot.py +13 -2
  61. scitex/plt/ax/_style/_style_boxplot.py +78 -32
  62. scitex/plt/ax/_style/_style_errorbar.py +17 -3
  63. scitex/plt/ax/_style/_style_scatter.py +17 -3
  64. scitex/plt/ax/_style/_style_violinplot.py +109 -0
  65. scitex/plt/color/_vizualize_colors.py +3 -3
  66. scitex/plt/styles/SCITEX_STYLE.yaml +104 -0
  67. scitex/plt/styles/__init__.py +57 -0
  68. scitex/plt/styles/_plot_defaults.py +209 -0
  69. scitex/plt/styles/_plot_postprocess.py +518 -0
  70. scitex/plt/styles/_style_loader.py +268 -0
  71. scitex/plt/styles/presets.py +208 -0
  72. scitex/plt/utils/_collect_figure_metadata.py +160 -18
  73. scitex/plt/utils/_colorbar.py +72 -10
  74. scitex/plt/utils/_configure_mpl.py +108 -52
  75. scitex/plt/utils/_crop.py +21 -7
  76. scitex/plt/utils/_figure_mm.py +21 -7
  77. scitex/stats/__init__.py +13 -1
  78. scitex/stats/_schema.py +578 -0
  79. scitex/stats/tests/__init__.py +13 -0
  80. scitex/stats/tests/correlation/__init__.py +13 -0
  81. scitex/stats/tests/correlation/_test_pearson.py +262 -0
  82. scitex/vis/__init__.py +6 -0
  83. scitex/vis/editor/__init__.py +23 -0
  84. scitex/vis/editor/_defaults.py +205 -0
  85. scitex/vis/editor/_edit.py +342 -0
  86. scitex/vis/editor/_mpl_editor.py +231 -0
  87. scitex/vis/editor/_tkinter_editor.py +466 -0
  88. scitex/vis/editor/_web_editor.py +1440 -0
  89. scitex/vis/model/plot_types.py +15 -15
  90. {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/METADATA +2 -1
  91. {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/RECORD +94 -67
  92. {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/WHEEL +1 -1
  93. scitex/plt/ax/_plot/_plot_ecdf.py +0 -84
  94. scitex/plt/ax/_plot/_plot_heatmap.py +0 -277
  95. scitex/plt/ax/_plot/_plot_joyplot.py +0 -77
  96. scitex/plt/ax/_plot/_plot_shaded_line.py +0 -142
  97. scitex/plt/presets.py +0 -224
  98. {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/entry_points.txt +0 -0
  99. {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/licenses/LICENSE +0 -0
@@ -27,12 +27,12 @@ _METHOD_ALTERNATIVES = {
27
27
  'bar': 'plot_bar', # already tracked
28
28
  'barh': 'plot_barh', # already tracked
29
29
  'hist': 'hist', # already tracked
30
- 'boxplot': 'plot_box or plot_boxplot',
31
- 'violinplot': 'plot_violin or plot_violinplot',
30
+ 'boxplot': 'stx_box or plot_boxplot',
31
+ 'violinplot': 'stx_violin or plot_violinplot',
32
32
  'fill_between': 'plot_fill_between',
33
33
  'errorbar': 'plot_errorbar',
34
34
  'contour': 'plot_contour',
35
- 'heatmap': 'plot_heatmap',
35
+ 'heatmap': 'stx_heatmap',
36
36
 
37
37
  # Seaborn methods (accessed via ax.sns_*)
38
38
  'scatterplot': 'sns_scatterplot',
@@ -60,42 +60,93 @@ def _warn_once(message, category=UserWarning):
60
60
  _warning_registry.add(message)
61
61
  warnings.warn(message, category, stacklevel=3)
62
62
 
63
- from ._export_as_csv_formatters import (_format_annotate, _format_bar,
64
- _format_barh, _format_boxplot,
65
- _format_contour, _format_errorbar,
66
- _format_eventplot, _format_fill,
67
- _format_fill_between, _format_hist,
68
- _format_imshow, _format_imshow2d,
69
- _format_plot, _format_plot_box,
70
- _format_plot_conf_mat,
71
- _format_plot_ecdf, _format_plot_fillv,
72
- _format_plot_heatmap,
73
- _format_plot_image,
74
- _format_plot_imshow,
75
- _format_plot_joyplot, _format_plot_kde,
76
- _format_plot_line,
77
- _format_plot_mean_ci,
78
- _format_plot_mean_std,
79
- _format_plot_median_iqr,
80
- _format_plot_raster,
81
- _format_plot_rectangle,
82
- _format_plot_scatter,
83
- _format_plot_scatter_hist,
84
- _format_plot_shaded_line,
85
- _format_plot_violin, _format_scatter,
86
- _format_sns_barplot,
87
- _format_sns_boxplot,
88
- _format_sns_heatmap,
89
- _format_sns_histplot,
90
- _format_sns_jointplot,
91
- _format_sns_kdeplot,
92
- _format_sns_lineplot,
93
- _format_sns_pairplot,
94
- _format_sns_scatterplot,
95
- _format_sns_stripplot,
96
- _format_sns_swarmplot,
97
- _format_sns_violinplot, _format_text,
98
- _format_violin, _format_violinplot)
63
+ from ._export_as_csv_formatters import (
64
+ # Standard matplotlib formatters
65
+ _format_annotate, _format_bar, _format_barh, _format_boxplot,
66
+ _format_contour, _format_contourf, _format_errorbar, _format_eventplot,
67
+ _format_fill, _format_fill_between, _format_hexbin, _format_hist,
68
+ _format_hist2d, _format_imshow, _format_imshow2d, _format_matshow,
69
+ _format_pie, _format_plot, _format_quiver, _format_scatter, _format_stem,
70
+ _format_step, _format_streamplot, _format_text, _format_violin,
71
+ _format_violinplot,
72
+ # Custom scitex formatters
73
+ _format_plot_box, _format_plot_conf_mat, _format_plot_ecdf,
74
+ _format_plot_fillv, _format_plot_heatmap, _format_plot_image,
75
+ _format_plot_imshow, _format_plot_joyplot, _format_plot_kde,
76
+ _format_plot_line, _format_plot_mean_ci, _format_plot_mean_std,
77
+ _format_plot_median_iqr, _format_plot_raster, _format_plot_rectangle,
78
+ _format_plot_scatter, _format_plot_scatter_hist, _format_plot_shaded_line,
79
+ _format_plot_violin,
80
+ # Seaborn formatters
81
+ _format_sns_barplot, _format_sns_boxplot, _format_sns_heatmap,
82
+ _format_sns_histplot, _format_sns_jointplot, _format_sns_kdeplot,
83
+ _format_sns_lineplot, _format_sns_pairplot, _format_sns_scatterplot,
84
+ _format_sns_stripplot, _format_sns_swarmplot, _format_sns_violinplot,
85
+ )
86
+
87
+ # Registry mapping method names to their formatter functions
88
+ _FORMATTER_REGISTRY = {
89
+ # Standard matplotlib methods
90
+ "annotate": _format_annotate,
91
+ "bar": _format_bar,
92
+ "barh": _format_barh,
93
+ "boxplot": _format_boxplot,
94
+ "contour": _format_contour,
95
+ "contourf": _format_contourf,
96
+ "errorbar": _format_errorbar,
97
+ "eventplot": _format_eventplot,
98
+ "fill": _format_fill,
99
+ "fill_between": _format_fill_between,
100
+ "hexbin": _format_hexbin,
101
+ "hist": _format_hist,
102
+ "hist2d": _format_hist2d,
103
+ "imshow": _format_imshow,
104
+ "imshow2d": _format_imshow2d,
105
+ "matshow": _format_matshow,
106
+ "pie": _format_pie,
107
+ "plot": _format_plot,
108
+ "quiver": _format_quiver,
109
+ "scatter": _format_scatter,
110
+ "stem": _format_stem,
111
+ "step": _format_step,
112
+ "streamplot": _format_streamplot,
113
+ "text": _format_text,
114
+ "violin": _format_violin,
115
+ "violinplot": _format_violinplot,
116
+ # Custom scitex methods
117
+ "stx_box": _format_plot_box,
118
+ "stx_conf_mat": _format_plot_conf_mat,
119
+ "stx_ecdf": _format_plot_ecdf,
120
+ "stx_fillv": _format_plot_fillv,
121
+ "stx_heatmap": _format_plot_heatmap,
122
+ "stx_image": _format_plot_image,
123
+ "plot_imshow": _format_plot_imshow,
124
+ "stx_joyplot": _format_plot_joyplot,
125
+ "stx_kde": _format_plot_kde,
126
+ "stx_line": _format_plot_line,
127
+ "stx_mean_ci": _format_plot_mean_ci,
128
+ "stx_mean_std": _format_plot_mean_std,
129
+ "stx_median_iqr": _format_plot_median_iqr,
130
+ "stx_raster": _format_plot_raster,
131
+ "stx_rectangle": _format_plot_rectangle,
132
+ "plot_scatter": _format_plot_scatter,
133
+ "stx_scatter_hist": _format_plot_scatter_hist,
134
+ "stx_shaded_line": _format_plot_shaded_line,
135
+ "stx_violin": _format_plot_violin,
136
+ # Seaborn methods (sns_ prefix)
137
+ "sns_barplot": _format_sns_barplot,
138
+ "sns_boxplot": _format_sns_boxplot,
139
+ "sns_heatmap": _format_sns_heatmap,
140
+ "sns_histplot": _format_sns_histplot,
141
+ "sns_jointplot": _format_sns_jointplot,
142
+ "sns_kdeplot": _format_sns_kdeplot,
143
+ "sns_lineplot": _format_sns_lineplot,
144
+ "sns_pairplot": _format_sns_pairplot,
145
+ "sns_scatterplot": _format_sns_scatterplot,
146
+ "sns_stripplot": _format_sns_stripplot,
147
+ "sns_swarmplot": _format_sns_swarmplot,
148
+ "sns_violinplot": _format_sns_violinplot,
149
+ }
99
150
 
100
151
 
101
152
  def _to_numpy(data):
@@ -167,7 +218,7 @@ def export_as_csv(history_records):
167
218
  else:
168
219
  message = (
169
220
  f"Method '{method}()' does not support data tracking for CSV export. "
170
- f"Consider using scitex plot methods (e.g., plot_image, plot_imshow) for data export support."
221
+ f"Consider using scitex plot methods (e.g., stx_image, plot_imshow) for data export support."
171
222
  )
172
223
  _warn_once(message)
173
224
  return pd.DataFrame()
@@ -219,6 +270,8 @@ def format_record(record):
219
270
  return _format_boxplot(id, tracked_dict, kwargs)
220
271
  elif method == "contour":
221
272
  return _format_contour(id, tracked_dict, kwargs)
273
+ elif method == "contourf":
274
+ return _format_contourf(id, tracked_dict, kwargs)
222
275
  elif method == "errorbar":
223
276
  return _format_errorbar(id, tracked_dict, kwargs)
224
277
  elif method == "eventplot":
@@ -227,10 +280,26 @@ def format_record(record):
227
280
  return _format_fill(id, tracked_dict, kwargs)
228
281
  elif method == "fill_between":
229
282
  return _format_fill_between(id, tracked_dict, kwargs)
283
+ elif method == "hexbin":
284
+ return _format_hexbin(id, tracked_dict, kwargs)
285
+ elif method == "hist2d":
286
+ return _format_hist2d(id, tracked_dict, kwargs)
230
287
  elif method == "imshow":
231
288
  return _format_imshow(id, tracked_dict, kwargs)
232
289
  elif method == "imshow2d":
233
290
  return _format_imshow2d(id, tracked_dict, kwargs)
291
+ elif method == "matshow":
292
+ return _format_matshow(id, tracked_dict, kwargs)
293
+ elif method == "pie":
294
+ return _format_pie(id, tracked_dict, kwargs)
295
+ elif method == "quiver":
296
+ return _format_quiver(id, tracked_dict, kwargs)
297
+ elif method == "stem":
298
+ return _format_stem(id, tracked_dict, kwargs)
299
+ elif method == "step":
300
+ return _format_step(id, tracked_dict, kwargs)
301
+ elif method == "streamplot":
302
+ return _format_streamplot(id, tracked_dict, kwargs)
234
303
  elif method == "violin":
235
304
  return _format_violin(id, tracked_dict, kwargs)
236
305
  elif method == "violinplot":
@@ -241,46 +310,46 @@ def format_record(record):
241
310
  return _format_annotate(id, tracked_dict, kwargs)
242
311
 
243
312
  # Custom plotting functions
244
- elif method == "plot_box":
313
+ elif method == "stx_box":
245
314
  return _format_plot_box(id, tracked_dict, kwargs)
246
- elif method == "plot_conf_mat":
315
+ elif method == "stx_conf_mat":
247
316
  return _format_plot_conf_mat(id, tracked_dict, kwargs)
248
- elif method == "plot_ecdf":
317
+ elif method == "stx_ecdf":
249
318
  return _format_plot_ecdf(id, tracked_dict, kwargs)
250
- elif method == "plot_fillv":
319
+ elif method == "stx_fillv":
251
320
  return _format_plot_fillv(id, tracked_dict, kwargs)
252
- elif method == "plot_heatmap":
321
+ elif method == "stx_heatmap":
253
322
  return _format_plot_heatmap(id, tracked_dict, kwargs)
254
- elif method == "plot_image":
323
+ elif method == "stx_image":
255
324
  return _format_plot_image(id, tracked_dict, kwargs)
256
325
  elif method == "plot_imshow":
257
326
  return _format_plot_imshow(id, tracked_dict, kwargs)
258
- elif method == "plot_joyplot":
327
+ elif method == "stx_joyplot":
259
328
  return _format_plot_joyplot(id, tracked_dict, kwargs)
260
- elif method == "plot_kde":
329
+ elif method == "stx_kde":
261
330
  return _format_plot_kde(id, tracked_dict, kwargs)
262
- elif method == "plot_line":
331
+ elif method == "stx_line":
263
332
  return _format_plot_line(id, tracked_dict, kwargs)
264
- elif method == "plot_mean_ci":
333
+ elif method == "stx_mean_ci":
265
334
  return _format_plot_mean_ci(id, tracked_dict, kwargs)
266
- elif method == "plot_mean_std":
335
+ elif method == "stx_mean_std":
267
336
  return _format_plot_mean_std(id, tracked_dict, kwargs)
268
- elif method == "plot_median_iqr":
337
+ elif method == "stx_median_iqr":
269
338
  return _format_plot_median_iqr(id, tracked_dict, kwargs)
270
- elif method == "plot_raster":
339
+ elif method == "stx_raster":
271
340
  return _format_plot_raster(id, tracked_dict, kwargs)
272
- elif method == "plot_rectangle":
341
+ elif method == "stx_rectangle":
273
342
  return _format_plot_rectangle(id, tracked_dict, kwargs)
274
343
  elif method == "plot_scatter":
275
344
  return _format_plot_scatter(id, tracked_dict, kwargs)
276
- elif method == "plot_scatter_hist":
345
+ elif method == "stx_scatter_hist":
277
346
  return _format_plot_scatter_hist(id, tracked_dict, kwargs)
278
- elif method == "plot_shaded_line":
347
+ elif method == "stx_shaded_line":
279
348
  return _format_plot_shaded_line(id, tracked_dict, kwargs)
280
- elif method == "plot_violin":
349
+ elif method == "stx_violin":
281
350
  return _format_plot_violin(id, tracked_dict, kwargs)
282
351
 
283
- # Seaborn functions
352
+ # Seaborn functions (sns_ prefix)
284
353
  elif method == "sns_barplot":
285
354
  return _format_sns_barplot(id, tracked_dict, kwargs)
286
355
  elif method == "sns_boxplot":
@@ -18,37 +18,46 @@ from ._format_barh import _format_barh
18
18
  from ._format_hist import _format_hist
19
19
  from ._format_boxplot import _format_boxplot
20
20
  from ._format_contour import _format_contour
21
+ from ._format_contourf import _format_contourf
21
22
  from ._format_errorbar import _format_errorbar
22
23
  from ._format_eventplot import _format_eventplot
23
24
  from ._format_fill import _format_fill
24
25
  from ._format_fill_between import _format_fill_between
26
+ from ._format_hexbin import _format_hexbin
27
+ from ._format_hist2d import _format_hist2d
25
28
  from ._format_imshow import _format_imshow
26
29
  from ._format_imshow2d import _format_imshow2d
30
+ from ._format_matshow import _format_matshow
31
+ from ._format_pie import _format_pie
32
+ from ._format_quiver import _format_quiver
33
+ from ._format_stem import _format_stem
34
+ from ._format_step import _format_step
35
+ from ._format_streamplot import _format_streamplot
27
36
  from ._format_violin import _format_violin
28
37
  from ._format_violinplot import _format_violinplot
29
38
 
30
39
  # Custom plotting formatters
31
40
  from ._format_plot_imshow import _format_plot_imshow
32
41
  from ._format_plot_box import _format_plot_box
33
- from ._format_plot_conf_mat import _format_plot_conf_mat
34
- from ._format_plot_ecdf import _format_plot_ecdf
35
- from ._format_plot_fillv import _format_plot_fillv
36
- from ._format_plot_heatmap import _format_plot_heatmap
37
- from ._format_plot_image import _format_plot_image
38
- from ._format_plot_joyplot import _format_plot_joyplot
42
+ from ._format_stx_conf_mat import _format_plot_conf_mat
43
+ from ._format_stx_ecdf import _format_plot_ecdf
44
+ from ._format_stx_fillv import _format_plot_fillv
45
+ from ._format_stx_heatmap import _format_plot_heatmap
46
+ from ._format_stx_image import _format_plot_image
47
+ from ._format_stx_joyplot import _format_plot_joyplot
39
48
  from ._format_plot_kde import _format_plot_kde
40
- from ._format_plot_line import _format_plot_line
41
- from ._format_plot_mean_ci import _format_plot_mean_ci
42
- from ._format_plot_mean_std import _format_plot_mean_std
43
- from ._format_plot_median_iqr import _format_plot_median_iqr
44
- from ._format_plot_raster import _format_plot_raster
45
- from ._format_plot_rectangle import _format_plot_rectangle
49
+ from ._format_stx_line import _format_plot_line
50
+ from ._format_stx_mean_ci import _format_plot_mean_ci
51
+ from ._format_stx_mean_std import _format_plot_mean_std
52
+ from ._format_stx_median_iqr import _format_plot_median_iqr
53
+ from ._format_stx_raster import _format_plot_raster
54
+ from ._format_stx_rectangle import _format_plot_rectangle
46
55
  from ._format_plot_scatter import _format_plot_scatter
47
- from ._format_plot_scatter_hist import _format_plot_scatter_hist
48
- from ._format_plot_shaded_line import _format_plot_shaded_line
49
- from ._format_plot_violin import _format_plot_violin
56
+ from ._format_stx_scatter_hist import _format_plot_scatter_hist
57
+ from ._format_stx_shaded_line import _format_plot_shaded_line
58
+ from ._format_stx_violin import _format_plot_violin
50
59
 
51
- # Seaborn formatters
60
+ # Seaborn formatters (sns_ prefix)
52
61
  from ._format_sns_barplot import _format_sns_barplot
53
62
  from ._format_sns_boxplot import _format_sns_boxplot
54
63
  from ._format_sns_heatmap import _format_sns_heatmap
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
4
+ # File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_contourf.py
5
+
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+
10
+ def _format_contourf(id, tracked_dict, kwargs):
11
+ """Format data from a filled contour plot call.
12
+
13
+ Args:
14
+ id (str): Identifier for the plot
15
+ tracked_dict (dict): Dictionary containing tracked data
16
+ kwargs (dict): Keyword arguments passed to contourf
17
+
18
+ Returns:
19
+ pd.DataFrame: Formatted data from contourf (flattened X, Y, Z grids)
20
+ """
21
+ if not tracked_dict or not isinstance(tracked_dict, dict):
22
+ return pd.DataFrame()
23
+
24
+ if 'args' in tracked_dict:
25
+ args = tracked_dict['args']
26
+ if isinstance(args, tuple):
27
+ # contourf can be called as:
28
+ # contourf(Z) - Z is 2D
29
+ # contourf(X, Y, Z) - X, Y are 1D or 2D, Z is 2D
30
+ if len(args) == 1:
31
+ Z = np.asarray(args[0])
32
+ X, Y = np.meshgrid(np.arange(Z.shape[1]), np.arange(Z.shape[0]))
33
+ elif len(args) >= 3:
34
+ X = np.asarray(args[0])
35
+ Y = np.asarray(args[1])
36
+ Z = np.asarray(args[2])
37
+ # If X, Y are 1D, create meshgrid
38
+ if X.ndim == 1 and Y.ndim == 1:
39
+ X, Y = np.meshgrid(X, Y)
40
+ else:
41
+ return pd.DataFrame()
42
+
43
+ # Flatten all arrays
44
+ df = pd.DataFrame({
45
+ f"{id}_contourf_x": X.flatten(),
46
+ f"{id}_contourf_y": Y.flatten(),
47
+ f"{id}_contourf_z": Z.flatten()
48
+ })
49
+ return df
50
+
51
+ return pd.DataFrame()
52
+
53
+
54
+ # EOF
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
4
+ # File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_hexbin.py
5
+
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+
10
+ def _format_hexbin(id, tracked_dict, kwargs):
11
+ """Format data from a hexbin call.
12
+
13
+ Args:
14
+ id (str): Identifier for the plot
15
+ tracked_dict (dict): Dictionary containing tracked data
16
+ kwargs (dict): Keyword arguments passed to hexbin
17
+
18
+ Returns:
19
+ pd.DataFrame: Formatted data from hexbin (input x, y data)
20
+ """
21
+ if not tracked_dict or not isinstance(tracked_dict, dict):
22
+ return pd.DataFrame()
23
+
24
+ if 'args' in tracked_dict:
25
+ args = tracked_dict['args']
26
+ if isinstance(args, tuple) and len(args) >= 2:
27
+ x = np.asarray(args[0]).flatten()
28
+ y = np.asarray(args[1]).flatten()
29
+
30
+ # Ensure same length
31
+ min_len = min(len(x), len(y))
32
+ x = x[:min_len]
33
+ y = y[:min_len]
34
+
35
+ df = pd.DataFrame({f"{id}_hexbin_x": x, f"{id}_hexbin_y": y})
36
+ return df
37
+
38
+ return pd.DataFrame()
39
+
40
+
41
+ # EOF
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
4
+ # File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_hist2d.py
5
+
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+
10
+ def _format_hist2d(id, tracked_dict, kwargs):
11
+ """Format data from a 2D histogram call.
12
+
13
+ Args:
14
+ id (str): Identifier for the plot
15
+ tracked_dict (dict): Dictionary containing tracked data
16
+ kwargs (dict): Keyword arguments passed to hist2d
17
+
18
+ Returns:
19
+ pd.DataFrame: Formatted data from 2D histogram (input x, y data)
20
+ """
21
+ if not tracked_dict or not isinstance(tracked_dict, dict):
22
+ return pd.DataFrame()
23
+
24
+ if 'args' in tracked_dict:
25
+ args = tracked_dict['args']
26
+ if isinstance(args, tuple) and len(args) >= 2:
27
+ x = np.asarray(args[0]).flatten()
28
+ y = np.asarray(args[1]).flatten()
29
+
30
+ # Ensure same length
31
+ min_len = min(len(x), len(y))
32
+ x = x[:min_len]
33
+ y = y[:min_len]
34
+
35
+ df = pd.DataFrame({f"{id}_hist2d_x": x, f"{id}_hist2d_y": y})
36
+ return df
37
+
38
+ return pd.DataFrame()
39
+
40
+
41
+ # EOF
@@ -1,57 +1,69 @@
1
1
  #!/usr/bin/env python3
2
2
  # -*- coding: utf-8 -*-
3
- # Timestamp: "2025-05-18 18:14:26 (ywatanabe)"
4
- # File: /data/gpfs/projects/punim2354/ywatanabe/scitex_repo/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_imshow.py
5
- # ----------------------------------------
6
- import os
7
- __FILE__ = __file__
8
- __DIR__ = os.path.dirname(__FILE__)
9
- # ----------------------------------------
3
+ # Timestamp: "2025-12-01 12:40:00 (ywatanabe)"
4
+ # File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_imshow.py
10
5
 
6
+ import numpy as np
11
7
  import pandas as pd
12
8
 
9
+
13
10
  def _format_imshow(id, tracked_dict, kwargs):
14
- """Format data from an imshow call."""
11
+ """Format data from an imshow call.
12
+
13
+ Args:
14
+ id (str): Identifier for the plot
15
+ tracked_dict (dict): Dictionary containing tracked data
16
+ kwargs (dict): Keyword arguments passed to imshow
17
+
18
+ Returns:
19
+ pd.DataFrame: Formatted data from imshow (flattened image with row, col indices)
20
+ """
21
+ if not tracked_dict or not isinstance(tracked_dict, dict):
22
+ return pd.DataFrame()
15
23
 
24
+ # Check for pre-formatted image_df (from plot_imshow wrapper)
16
25
  if tracked_dict.get("image_df") is not None:
17
26
  return tracked_dict.get("image_df")
18
27
 
19
- # # Placeholder implementation
20
- # # Imshow displays an image (2D array)
21
- # if len(args) >= 1:
22
- # img = args[0]
23
-
24
- # # Convert 2D image to long format
25
- # if isinstance(img, np.ndarray) and img.ndim == 2:
26
- # rows, cols = img.shape
27
- # row_indices, col_indices = np.meshgrid(
28
- # range(rows), range(cols), indexing="ij"
29
- # )
30
-
31
- # df = pd.DataFrame(
32
- # {
33
- # f"{id}_imshow_row": row_indices.flatten(),
34
- # f"{id}_imshow_col": col_indices.flatten(),
35
- # f"{id}_imshow_value": img.flatten(),
36
- # }
37
- # )
38
- # return df
39
-
40
- # # Handle RGB/RGBA images
41
- # elif isinstance(img, np.ndarray) and img.ndim == 3:
42
- # rows, cols, channels = img.shape
43
- # row_indices, col_indices = np.meshgrid(
44
- # range(rows), range(cols), indexing="ij"
45
- # )
46
-
47
- # data = {
48
- # f"{id}_imshow_row": row_indices.flatten(),
49
- # f"{id}_imshow_col": col_indices.flatten(),
50
- # }
51
-
52
- # # Add channel data
53
- # for c in range(channels):
54
- # data[f"{id}_imshow_channel{c}"] = img[:, :, c].flatten()
55
-
56
- # return pd.DataFrame(data)
57
- # return pd.DataFrame()
28
+ # Handle raw args from __getattr__ proxied calls
29
+ if 'args' in tracked_dict:
30
+ args = tracked_dict['args']
31
+ if isinstance(args, tuple) and len(args) > 0:
32
+ img = np.asarray(args[0])
33
+
34
+ # Handle 2D grayscale image
35
+ if img.ndim == 2:
36
+ rows, cols = img.shape
37
+ row_indices, col_indices = np.meshgrid(
38
+ range(rows), range(cols), indexing="ij"
39
+ )
40
+
41
+ df = pd.DataFrame(
42
+ {
43
+ f"{id}_imshow_row": row_indices.flatten(),
44
+ f"{id}_imshow_col": col_indices.flatten(),
45
+ f"{id}_imshow_value": img.flatten(),
46
+ }
47
+ )
48
+ return df
49
+
50
+ # Handle RGB/RGBA images (3D array)
51
+ elif img.ndim == 3:
52
+ rows, cols, channels = img.shape
53
+ row_indices, col_indices = np.meshgrid(
54
+ range(rows), range(cols), indexing="ij"
55
+ )
56
+
57
+ data = {
58
+ f"{id}_imshow_row": row_indices.flatten(),
59
+ f"{id}_imshow_col": col_indices.flatten(),
60
+ }
61
+
62
+ # Add channel data (R, G, B, A)
63
+ channel_names = ['R', 'G', 'B', 'A'][:channels]
64
+ for c, name in enumerate(channel_names):
65
+ data[f"{id}_imshow_{name}"] = img[:, :, c].flatten()
66
+
67
+ return pd.DataFrame(data)
68
+
69
+ return pd.DataFrame()
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
4
+ # File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_matshow.py
5
+
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+
10
+ def _format_matshow(id, tracked_dict, kwargs):
11
+ """Format data from a matshow call.
12
+
13
+ Args:
14
+ id (str): Identifier for the plot
15
+ tracked_dict (dict): Dictionary containing tracked data
16
+ kwargs (dict): Keyword arguments passed to matshow
17
+
18
+ Returns:
19
+ pd.DataFrame: Formatted data from matshow (flattened matrix with row, col indices)
20
+ """
21
+ if not tracked_dict or not isinstance(tracked_dict, dict):
22
+ return pd.DataFrame()
23
+
24
+ if 'args' in tracked_dict:
25
+ args = tracked_dict['args']
26
+ if isinstance(args, tuple) and len(args) > 0:
27
+ Z = np.asarray(args[0])
28
+
29
+ # Create row/col indices
30
+ rows, cols = np.indices(Z.shape)
31
+
32
+ df = pd.DataFrame({
33
+ f"{id}_matshow_row": rows.flatten(),
34
+ f"{id}_matshow_col": cols.flatten(),
35
+ f"{id}_matshow_value": Z.flatten()
36
+ })
37
+ return df
38
+
39
+ return pd.DataFrame()
40
+
41
+
42
+ # EOF
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
4
+ # File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_pie.py
5
+
6
+ import numpy as np
7
+ import pandas as pd
8
+
9
+
10
+ def _format_pie(id, tracked_dict, kwargs):
11
+ """Format data from a pie chart call.
12
+
13
+ Args:
14
+ id (str): Identifier for the plot
15
+ tracked_dict (dict): Dictionary containing tracked data
16
+ kwargs (dict): Keyword arguments passed to pie
17
+
18
+ Returns:
19
+ pd.DataFrame: Formatted data from pie chart
20
+ """
21
+ if not tracked_dict or not isinstance(tracked_dict, dict):
22
+ return pd.DataFrame()
23
+
24
+ if 'args' in tracked_dict:
25
+ args = tracked_dict['args']
26
+ if isinstance(args, tuple) and len(args) > 0:
27
+ x = np.asarray(args[0])
28
+
29
+ data = {f"{id}_pie_values": x}
30
+
31
+ # Add labels if provided
32
+ labels = kwargs.get('labels', None)
33
+ if labels is not None:
34
+ data[f"{id}_pie_labels"] = labels
35
+
36
+ df = pd.DataFrame(data)
37
+ return df
38
+
39
+ return pd.DataFrame()
40
+
41
+
42
+ # EOF