babelplot 2024.5__tar.gz → 2025.1__tar.gz
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.
- {babelplot-2024.5 → babelplot-2025.1}/PKG-INFO +1 -1
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/catalog/bokeh_.py +2 -2
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/catalog/matplotlib_.py +11 -10
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/catalog/plotly_.py +8 -8
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/catalog/vedo_.py +4 -3
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/main.py +1 -1
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/specification/plot.py +2 -2
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/type/figure.py +1 -1
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/type/frame.py +3 -3
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/type/plot.py +2 -2
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/version.py +1 -1
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot.egg-info/PKG-INFO +1 -1
- {babelplot-2024.5 → babelplot-2025.1}/MANIFEST.in +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/README-COPYRIGHT-utf8.txt +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/README-LICENCE-utf8.txt +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/README.rst +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/documentation/wiki/description.asciidoc +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/__init__.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/helper/creation.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/helper/validation.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/specification/backend.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/backend/specification/runtime.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/constant/backend.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/constant/project.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/extension/enum_.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/help.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/specification/dimension.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/task/show_pyqt6.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot/type/base.py +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot.egg-info/SOURCES.txt +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot.egg-info/dependency_links.txt +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot.egg-info/requires.txt +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/package/babelplot.egg-info/top_level.txt +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/pyproject.toml +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/requirements.txt +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/setup.cfg +0 -0
- {babelplot-2024.5 → babelplot-2025.1}/setup.py +0 -0
|
@@ -32,12 +32,12 @@ backend_frame_t = backend_figure_t
|
|
|
32
32
|
|
|
33
33
|
def _NewPlot(
|
|
34
34
|
frame: backend_frame_t,
|
|
35
|
-
type_: plot_type_h | type
|
|
35
|
+
type_: plot_type_h | type[backend_plot_t],
|
|
36
36
|
plot_function: h.Callable | None,
|
|
37
37
|
*args,
|
|
38
38
|
title: str | None = None, # If _, then it is swallowed by kwargs!
|
|
39
39
|
**kwargs,
|
|
40
|
-
) -> tuple[backend_plot_t, type
|
|
40
|
+
) -> tuple[backend_plot_t, type[backend_plot_t]]:
|
|
41
41
|
""""""
|
|
42
42
|
if plot_function is None:
|
|
43
43
|
if hasattr(backend_frame_t, type_):
|
|
@@ -20,13 +20,14 @@ from babelplot.type.frame import frame_t as base_frame_t
|
|
|
20
20
|
from babelplot.type.plot import plot_t as base_plot_t
|
|
21
21
|
from logger_36 import LOGGER
|
|
22
22
|
from matplotlib.artist import Artist as backend_plot_t # noqa
|
|
23
|
+
from matplotlib.container import Container as backend_plots_t # noqa
|
|
23
24
|
from matplotlib.gridspec import GridSpec as grid_spec_t # noqa
|
|
24
25
|
from matplotlib.markers import MarkerStyle as marker_style_t # noqa
|
|
25
26
|
from matplotlib.patches import Polygon as polygon_t # noqa
|
|
26
27
|
from matplotlib.pyplot import Axes as backend_frame_2d_t # noqa
|
|
27
28
|
from matplotlib.pyplot import Figure as backend_figure_t # noqa
|
|
28
29
|
from matplotlib.pyplot import figure as NewBackendFigure # noqa
|
|
29
|
-
from mpl_toolkits.mplot3d import Axes3D as backend_frame_3d_t
|
|
30
|
+
from mpl_toolkits.mplot3d import Axes3D as backend_frame_3d_t # noqa
|
|
30
31
|
|
|
31
32
|
import matplotlib as mlpl # noqa
|
|
32
33
|
|
|
@@ -39,7 +40,7 @@ backend_frame_h = backend_frame_2d_t | backend_frame_3d_t
|
|
|
39
40
|
|
|
40
41
|
def _NewPlot(
|
|
41
42
|
frame: backend_frame_h,
|
|
42
|
-
type_: plot_type_h | type
|
|
43
|
+
type_: plot_type_h | type[backend_plot_h],
|
|
43
44
|
plot_function: h.Callable | None,
|
|
44
45
|
*args,
|
|
45
46
|
title: str | None = None, # /!\ If _, then it is swallowed by kwargs!
|
|
@@ -269,7 +270,7 @@ def _ElevationSurface(frame: backend_frame_2d_t, *args, **kwargs) -> backend_plo
|
|
|
269
270
|
return frame.plot_surface(x, y, elevation, **kwargs)
|
|
270
271
|
|
|
271
272
|
|
|
272
|
-
def
|
|
273
|
+
def _IsoContour(frame: backend_frame_2d_t, *args, **kwargs) -> backend_plot_t:
|
|
273
274
|
""""""
|
|
274
275
|
if args.__len__() == 2:
|
|
275
276
|
values, value = args
|
|
@@ -284,7 +285,7 @@ def _Isocontour(frame: backend_frame_2d_t, *args, **kwargs) -> backend_plot_t:
|
|
|
284
285
|
return output
|
|
285
286
|
|
|
286
287
|
|
|
287
|
-
def
|
|
288
|
+
def _IsoSurface(frame: backend_frame_2d_t, *args, **kwargs) -> backend_plot_t:
|
|
288
289
|
""""""
|
|
289
290
|
if "step_size" in kwargs:
|
|
290
291
|
mc_kwargs = {"step_size": kwargs["step_size"]}
|
|
@@ -307,7 +308,7 @@ def _Mesh(
|
|
|
307
308
|
)
|
|
308
309
|
|
|
309
310
|
|
|
310
|
-
def _BarH(frame: backend_frame_2d_t, *args, **kwargs) ->
|
|
311
|
+
def _BarH(frame: backend_frame_2d_t, *args, **kwargs) -> backend_plots_t:
|
|
311
312
|
""""""
|
|
312
313
|
if args.__len__() == 1:
|
|
313
314
|
counts = args[0]
|
|
@@ -318,7 +319,7 @@ def _BarH(frame: backend_frame_2d_t, *args, **kwargs) -> backend_plot_t:
|
|
|
318
319
|
return frame.barh(positions, counts, **kwargs)
|
|
319
320
|
|
|
320
321
|
|
|
321
|
-
def _BarV(frame: backend_frame_2d_t, *args, **kwargs) ->
|
|
322
|
+
def _BarV(frame: backend_frame_2d_t, *args, **kwargs) -> backend_plots_t:
|
|
322
323
|
""""""
|
|
323
324
|
if args.__len__() == 1:
|
|
324
325
|
counts = args[0]
|
|
@@ -371,7 +372,7 @@ PLOTS[plot_e.SCATTER][1] = backend_frame_2d_t.scatter
|
|
|
371
372
|
PLOTS[plot_e.POLYLINE][1] = backend_frame_2d_t.plot
|
|
372
373
|
PLOTS[plot_e.POLYGON][1] = _Polygon
|
|
373
374
|
PLOTS[plot_e.ARROWS][1] = _Arrows2
|
|
374
|
-
PLOTS[plot_e.ISOSET][1] =
|
|
375
|
+
PLOTS[plot_e.ISOSET][1] = _IsoContour
|
|
375
376
|
PLOTS[plot_e.BARH][1] = _BarH
|
|
376
377
|
PLOTS[plot_e.BARV][1] = _BarV
|
|
377
378
|
PLOTS[plot_e.PIE][1] = backend_frame_2d_t.pie
|
|
@@ -382,7 +383,7 @@ PLOTS[plot_e.SCATTER][2] = backend_frame_3d_t.scatter
|
|
|
382
383
|
PLOTS[plot_e.POLYLINE][2] = backend_frame_3d_t.plot
|
|
383
384
|
PLOTS[plot_e.ARROWS][2] = _Arrows3
|
|
384
385
|
PLOTS[plot_e.ELEVATION][2] = _ElevationSurface
|
|
385
|
-
PLOTS[plot_e.ISOSET][2] =
|
|
386
|
+
PLOTS[plot_e.ISOSET][2] = _IsoSurface
|
|
386
387
|
PLOTS[plot_e.MESH][2] = _Mesh
|
|
387
388
|
PLOTS[plot_e.BAR3][2] = _Bar3
|
|
388
389
|
PLOTS[plot_e.TEXT][2] = _Text3
|
|
@@ -409,8 +410,8 @@ TRANSLATIONS = {
|
|
|
409
410
|
(_BarV, "color"): "color",
|
|
410
411
|
(_BarV, "offset"): "bottom",
|
|
411
412
|
(_ElevationSurface, "color_face"): "color",
|
|
412
|
-
(
|
|
413
|
-
(
|
|
413
|
+
(_IsoContour, "color"): "colors",
|
|
414
|
+
(_IsoSurface, "color_face"): "color",
|
|
414
415
|
(_Mesh, "color_face"): "color",
|
|
415
416
|
(_Polygon, "color_edge"): "edgecolor",
|
|
416
417
|
(_Polygon, "color_face"): "facecolor",
|
|
@@ -10,7 +10,7 @@ import typing as h
|
|
|
10
10
|
from pathlib import Path as path_t
|
|
11
11
|
|
|
12
12
|
import numpy as nmpy
|
|
13
|
-
import plotly.figure_factory as fcry
|
|
13
|
+
import plotly.figure_factory as fcry # noqa
|
|
14
14
|
import plotly.graph_objects as plly # noqa
|
|
15
15
|
from babelplot.backend.specification.backend import backend_e
|
|
16
16
|
from babelplot.specification.plot import (
|
|
@@ -46,12 +46,12 @@ _FIGURE_CONFIG = {
|
|
|
46
46
|
|
|
47
47
|
def _NewPlot(
|
|
48
48
|
_: backend_frame_h,
|
|
49
|
-
type_: plot_type_h | type
|
|
49
|
+
type_: plot_type_h | type[backend_plot_t],
|
|
50
50
|
plot_function: h.Callable | None,
|
|
51
51
|
*args,
|
|
52
52
|
title: str | None = None, # If _, then it is swallowed by kwargs!
|
|
53
53
|
**kwargs,
|
|
54
|
-
) -> tuple[backend_plot_t, type
|
|
54
|
+
) -> tuple[backend_plot_t, type[backend_plot_t]]:
|
|
55
55
|
""""""
|
|
56
56
|
if plot_function is None:
|
|
57
57
|
if hasattr(plly, type_):
|
|
@@ -226,7 +226,7 @@ def _ElevationSurface(*args, **kwargs) -> backend_plot_t:
|
|
|
226
226
|
return plly.Surface(contours={}, x=x, y=y, z=elevation, **kwargs)
|
|
227
227
|
|
|
228
228
|
|
|
229
|
-
def
|
|
229
|
+
def _IsoContour(*args, **kwargs) -> backend_plot_t:
|
|
230
230
|
""""""
|
|
231
231
|
parameters = {
|
|
232
232
|
"contours_coloring": "lines",
|
|
@@ -252,7 +252,7 @@ def _Isocontour(*args, **kwargs) -> backend_plot_t:
|
|
|
252
252
|
return plly.Contour(**parameters)
|
|
253
253
|
|
|
254
254
|
|
|
255
|
-
def
|
|
255
|
+
def _IsoSurface(values: array_t, value: float, *args, **kwargs) -> backend_plot_t:
|
|
256
256
|
""""""
|
|
257
257
|
if args.__len__() == 3:
|
|
258
258
|
x, y, z = args
|
|
@@ -354,7 +354,7 @@ PLOTS[plot_e.SCATTER][1] = _Scatter2
|
|
|
354
354
|
PLOTS[plot_e.POLYLINE][1] = _Polyline2
|
|
355
355
|
PLOTS[plot_e.POLYGON][1] = _Polygon
|
|
356
356
|
PLOTS[plot_e.ARROWS][1] = _Arrows2
|
|
357
|
-
PLOTS[plot_e.ISOSET][1] =
|
|
357
|
+
PLOTS[plot_e.ISOSET][1] = _IsoContour
|
|
358
358
|
PLOTS[plot_e.BARH][1] = _BarH
|
|
359
359
|
PLOTS[plot_e.BARV][1] = _BarV
|
|
360
360
|
PLOTS[plot_e.PIE][1] = _Pie
|
|
@@ -365,7 +365,7 @@ PLOTS[plot_e.SCATTER][2] = _Scatter3
|
|
|
365
365
|
PLOTS[plot_e.POLYLINE][2] = _Polyline3
|
|
366
366
|
PLOTS[plot_e.ARROWS][2] = _Arrows3
|
|
367
367
|
PLOTS[plot_e.ELEVATION][2] = _ElevationSurface
|
|
368
|
-
PLOTS[plot_e.ISOSET][2] =
|
|
368
|
+
PLOTS[plot_e.ISOSET][2] = _IsoSurface
|
|
369
369
|
PLOTS[plot_e.MESH][2] = _Mesh
|
|
370
370
|
PLOTS[plot_e.TEXT][2] = _Text3
|
|
371
371
|
|
|
@@ -373,7 +373,7 @@ PLOTS[plot_e.TEXT][2] = _Text3
|
|
|
373
373
|
TRANSLATIONS = {
|
|
374
374
|
"alpha": "opacity",
|
|
375
375
|
"color_face": "surfacecolor",
|
|
376
|
-
(
|
|
376
|
+
(_IsoSurface, "color_face"): UNDEFINED_PARAMETER,
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
|
|
@@ -17,6 +17,7 @@ from babelplot.type.figure import figure_t as base_figure_t
|
|
|
17
17
|
from babelplot.type.frame import frame_t as base_frame_t
|
|
18
18
|
from babelplot.type.plot import plot_t as base_plot_t
|
|
19
19
|
from numpy import ndarray as array_t
|
|
20
|
+
from vedo import Mesh as backend_plot_t # noqa
|
|
20
21
|
from vedo import Plotter as backend_figure_t # noqa
|
|
21
22
|
from vedo import Volume as volume_t # noqa
|
|
22
23
|
|
|
@@ -28,12 +29,12 @@ backend_frame_t = backend_figure_t
|
|
|
28
29
|
|
|
29
30
|
def _NewPlot(
|
|
30
31
|
frame: backend_frame_t,
|
|
31
|
-
type_: plot_type_h | type
|
|
32
|
+
type_: plot_type_h | type[backend_plot_h],
|
|
32
33
|
plot_function: h.Callable | None,
|
|
33
34
|
*args,
|
|
34
35
|
title: str | None = None, # If _, then it is swallowed by kwargs!
|
|
35
36
|
**kwargs,
|
|
36
|
-
) -> tuple[backend_plot_h, type
|
|
37
|
+
) -> tuple[backend_plot_h, type[backend_plot_h]]:
|
|
37
38
|
""""""
|
|
38
39
|
if plot_function is None:
|
|
39
40
|
if hasattr(vedo, type_):
|
|
@@ -89,7 +90,7 @@ figure_t: base_figure_t = type(
|
|
|
89
90
|
)
|
|
90
91
|
|
|
91
92
|
|
|
92
|
-
def _IsoSurface(volume: array_t, iso_value: float, *_, **kwargs) ->
|
|
93
|
+
def _IsoSurface(volume: array_t, iso_value: float, *_, **kwargs) -> backend_plot_t:
|
|
93
94
|
""""""
|
|
94
95
|
return volume_t(volume).isosurface(value=[iso_value], **kwargs)
|
|
95
96
|
|
|
@@ -139,7 +139,7 @@ KNOWN_PLOT_TYPES = EnumValues(plot_e)
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
plot_type_h = str | plot_e
|
|
142
|
-
backend_plots_per_type_h = tuple[type
|
|
142
|
+
backend_plots_per_type_h = tuple[type[UNAVAILABLE_for_this_DIM] | h.Callable, ...]
|
|
143
143
|
backend_plots_h = dict[plot_e, backend_plots_per_type_h]
|
|
144
144
|
|
|
145
145
|
|
|
@@ -286,7 +286,7 @@ PLOT_DESCRIPTION = {
|
|
|
286
286
|
|
|
287
287
|
|
|
288
288
|
def PlotsFromTemplate() -> (
|
|
289
|
-
dict[plot_e, list[type
|
|
289
|
+
dict[plot_e, list[type[UNAVAILABLE_for_this_DIM] | h.Callable]]
|
|
290
290
|
):
|
|
291
291
|
""""""
|
|
292
292
|
return {_key: 3 * [UNAVAILABLE_for_this_DIM] for _key in PLOT_DESCRIPTION.keys()}
|
|
@@ -33,7 +33,7 @@ class figure_t(base_figure_t):
|
|
|
33
33
|
|
|
34
34
|
title: str | None = None
|
|
35
35
|
offline_version: bool = False
|
|
36
|
-
frame_class: type
|
|
36
|
+
frame_class: type[frame_t] | None = dtcl.field(init=False, default=None)
|
|
37
37
|
frames: list[frame_t] = dtcl.field(init=False, default_factory=list)
|
|
38
38
|
locations: list[tuple[int, int]] = dtcl.field(init=False, default_factory=list)
|
|
39
39
|
shape: list[int] = dtcl.field(init=False, default_factory=_DefaultShape)
|
|
@@ -15,7 +15,7 @@ from babelplot.type.base import babelplot_element_t as base_frame_t
|
|
|
15
15
|
from babelplot.type.base import backend_frame_h, backend_plot_h
|
|
16
16
|
from babelplot.type.plot import BackendPlotFromAny, plot_t
|
|
17
17
|
|
|
18
|
-
plot_type_w_pbe_h = plot_type_h | type
|
|
18
|
+
plot_type_w_pbe_h = plot_type_h | type[backend_plot_h]
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
@dtcl.dataclass(repr=False, eq=False)
|
|
@@ -23,7 +23,7 @@ class frame_t(base_frame_t):
|
|
|
23
23
|
title: str | None = None
|
|
24
24
|
dim: dim_e | None = None
|
|
25
25
|
frame_dim: int | None = dtcl.field(init=False, default=None)
|
|
26
|
-
plot_class: type
|
|
26
|
+
plot_class: type[plot_t] | None = dtcl.field(init=False, default=None)
|
|
27
27
|
plots: list[plot_t] = dtcl.field(init=False, default_factory=list)
|
|
28
28
|
|
|
29
29
|
def __post_init__(self) -> None:
|
|
@@ -90,7 +90,7 @@ class frame_t(base_frame_t):
|
|
|
90
90
|
*args,
|
|
91
91
|
title: str | None = None,
|
|
92
92
|
**kwargs,
|
|
93
|
-
) -> tuple[h.Any, type
|
|
93
|
+
) -> tuple[h.Any, type[backend_plot_h]]:
|
|
94
94
|
"""
|
|
95
95
|
The returned object should be backend_plot_h. However, some backends might not
|
|
96
96
|
have a specific class for each plot type. For example, Matplotlib returns an
|
|
@@ -21,7 +21,7 @@ from babelplot.type.base import backend_plot_h
|
|
|
21
21
|
class plot_t(base_plot_t):
|
|
22
22
|
title: str | None = None
|
|
23
23
|
# See babelplot.type.frame.NewBackendPlot for an explanation
|
|
24
|
-
backend_type: type
|
|
24
|
+
backend_type: type[backend_plot_h] | None = dtcl.field(init=False, default=None)
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def BackendPlotFromPlotE(
|
|
@@ -51,7 +51,7 @@ def BackendPlotFromPlotE(
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
def BackendPlotFromAny(
|
|
54
|
-
spec: plot_type_h | type
|
|
54
|
+
spec: plot_type_h | type[backend_plot_h],
|
|
55
55
|
frame_dim: int,
|
|
56
56
|
backend: str,
|
|
57
57
|
backend_plots: backend_plots_h,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|