babelplot 2025.12__tar.gz → 2025.13__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-2025.12 → babelplot-2025.13}/PKG-INFO +1 -1
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/backend/catalog/matplotlib_.py +2 -2
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/backend/catalog/plotly_.py +7 -8
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/backend/catalog/vedo_.py +2 -2
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/version.py +1 -1
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot.egg-info/PKG-INFO +1 -1
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot.egg-info/SOURCES.txt +0 -1
- babelplot-2025.12/package/babelplot/task/color.py +0 -156
- {babelplot-2025.12 → babelplot-2025.13}/MANIFEST.in +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/README-COPYRIGHT-utf8.txt +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/README-LICENCE-utf8.txt +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/README.rst +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/documentation/wiki/description.asciidoc +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/__init__.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/api/type.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/backend/catalog/bokeh_.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/backend/helper/creation.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/backend/helper/validation.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/constant/backend.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/constant/path.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/constant/project.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/extension/enum_.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/extension/function.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/runtime/backends.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/task/help.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/task/instantiation.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/task/plotting.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/task/showing.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/backend.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/dimension.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/ffp_base.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/figure.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/frame.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/plot.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/plot_function.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/plot_type.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot/type/translator.py +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot.egg-info/dependency_links.txt +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot.egg-info/requires.txt +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/package/babelplot.egg-info/top_level.txt +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/pyproject.toml +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/requirements.txt +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/setup.cfg +0 -0
- {babelplot-2025.12 → babelplot-2025.13}/setup.py +0 -0
|
@@ -10,7 +10,7 @@ import typing as h
|
|
|
10
10
|
import matplotlib.pyplot as pypl # noqa
|
|
11
11
|
import numpy as nmpy
|
|
12
12
|
import skimage.measure as msre
|
|
13
|
-
from
|
|
13
|
+
from color_spec_changer.translation import NewTranslatedColor
|
|
14
14
|
from babelplot.task.plotting import NewPlotFunctionsTemplate
|
|
15
15
|
from babelplot.type.dimension import dim_e
|
|
16
16
|
from babelplot.type.ffp_base import backend_element_h
|
|
@@ -453,7 +453,7 @@ TRANSLATIONS = {
|
|
|
453
453
|
_Mesh: {
|
|
454
454
|
"facecolors": (
|
|
455
455
|
"color",
|
|
456
|
-
lambda _:
|
|
456
|
+
lambda _: NewTranslatedColor(_, "hex", index_or_reduction=0)[0],
|
|
457
457
|
)
|
|
458
458
|
},
|
|
459
459
|
_Polygon: {
|
|
@@ -13,7 +13,8 @@ from pathlib import Path as path_t
|
|
|
13
13
|
import numpy as nmpy
|
|
14
14
|
import plotly.figure_factory as fcry # noqa
|
|
15
15
|
import plotly.graph_objects as plly # noqa
|
|
16
|
-
from
|
|
16
|
+
from color_spec_changer.analysis import NColorsAndFormat
|
|
17
|
+
from color_spec_changer.translation import NewTranslatedColor
|
|
17
18
|
from babelplot.task.plotting import NewPlotFunctionsTemplate
|
|
18
19
|
from babelplot.task.showing import ShowHTMLPlotWithPyQt
|
|
19
20
|
from babelplot.type.dimension import dim_e
|
|
@@ -500,15 +501,13 @@ def _ApplyGlobalTranslation(
|
|
|
500
501
|
marker[wanted] = value
|
|
501
502
|
del kwargs[passed]
|
|
502
503
|
if "color" in marker:
|
|
503
|
-
|
|
504
|
+
format_ = NColorsAndFormat(marker["color"])
|
|
505
|
+
n_colors = format_.n_colors
|
|
504
506
|
if n_colors > 1:
|
|
505
|
-
|
|
507
|
+
translated, _ = NewTranslatedColor(marker["color"], "function_rgb255")
|
|
506
508
|
colorscale = [
|
|
507
|
-
[
|
|
508
|
-
|
|
509
|
-
f"rgb({round(255.0*_red)}, {round(255.0*_grn)}, {round(255.0*_blu)})",
|
|
510
|
-
]
|
|
511
|
-
for _idx, (_red, _grn, _blu) in enumerate(marker["color"])
|
|
509
|
+
[_idx / (n_colors - 1), _clr]
|
|
510
|
+
for _idx, _clr in enumerate(translated)
|
|
512
511
|
]
|
|
513
512
|
marker["colorscale"] = colorscale
|
|
514
513
|
marker["color"] = tuple(_[0] for _ in colorscale)
|
|
@@ -8,7 +8,7 @@ import dataclasses as d
|
|
|
8
8
|
import typing as h
|
|
9
9
|
from multiprocessing import Process as process_t
|
|
10
10
|
|
|
11
|
-
from
|
|
11
|
+
from color_spec_changer.translation import NewTranslatedColor
|
|
12
12
|
from babelplot.task.plotting import NewPlotFunctionsTemplate, SetDefaultPlotFunction
|
|
13
13
|
from babelplot.type.dimension import dim_e
|
|
14
14
|
from babelplot.type.figure import figure_t as base_figure_t
|
|
@@ -195,7 +195,7 @@ TRANSLATIONS = {
|
|
|
195
195
|
_Mesh: {
|
|
196
196
|
"color_face": (
|
|
197
197
|
"color_face",
|
|
198
|
-
lambda _:
|
|
198
|
+
lambda _: NewTranslatedColor(_, "hex", index_or_reduction=0)[0],
|
|
199
199
|
)
|
|
200
200
|
},
|
|
201
201
|
}
|
|
@@ -26,7 +26,6 @@ package/babelplot/constant/project.py
|
|
|
26
26
|
package/babelplot/extension/enum_.py
|
|
27
27
|
package/babelplot/extension/function.py
|
|
28
28
|
package/babelplot/runtime/backends.py
|
|
29
|
-
package/babelplot/task/color.py
|
|
30
29
|
package/babelplot/task/help.py
|
|
31
30
|
package/babelplot/task/instantiation.py
|
|
32
31
|
package/babelplot/task/plotting.py
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Copyright CNRS/Inria/UniCA
|
|
3
|
-
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2022
|
|
4
|
-
SEE COPYRIGHT NOTICE BELOW
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import typing as h
|
|
8
|
-
|
|
9
|
-
import numpy as nmpy
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
import matplotlib.colors as colr
|
|
13
|
-
except ModuleNotFoundError:
|
|
14
|
-
colr = None
|
|
15
|
-
else:
|
|
16
|
-
AsHex = lambda _: colr.to_hex(_).upper()
|
|
17
|
-
AsRGB1 = colr.to_rgb
|
|
18
|
-
AsRGB255 = lambda _: nmpy.round(255.0 * nmpy.array(colr.to_rgb(_))).astype(
|
|
19
|
-
nmpy.uint8
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
assert colr, "No module found for color conversion."
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
array_t = nmpy.ndarray
|
|
27
|
-
|
|
28
|
-
_FORMAT_FROM_LENGTH = {1: "g", 2: "ga", 3: "rgb", 4: "rgba"}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def NColorsAndFormat(color: h.Any, /) -> tuple[int, str]:
|
|
32
|
-
""""""
|
|
33
|
-
if isinstance(color, str):
|
|
34
|
-
if color[0] == "#":
|
|
35
|
-
format_ = "hex"
|
|
36
|
-
else:
|
|
37
|
-
format_ = "name"
|
|
38
|
-
return 1, format_
|
|
39
|
-
|
|
40
|
-
# Note: array_t's are not typing sequences.
|
|
41
|
-
if isinstance(color, h.Sequence): # i.e. true sequence, not str.
|
|
42
|
-
first_color = color[0] # or first component of color if just one.
|
|
43
|
-
|
|
44
|
-
if isinstance(first_color, h.Sequence | array_t): # including str.
|
|
45
|
-
_, format_ = NColorsAndFormat(first_color)
|
|
46
|
-
return color.__len__(), format_
|
|
47
|
-
|
|
48
|
-
format_length = color.__len__()
|
|
49
|
-
if isinstance(first_color, int):
|
|
50
|
-
format_max = 255
|
|
51
|
-
else:
|
|
52
|
-
format_max = 1
|
|
53
|
-
return 1, f"{_FORMAT_FROM_LENGTH[format_length]}{format_max}"
|
|
54
|
-
|
|
55
|
-
if isinstance(color, array_t):
|
|
56
|
-
if color.ndim == 1:
|
|
57
|
-
format_length = color.size
|
|
58
|
-
if nmpy.issubdtype(color.dtype, nmpy.integer):
|
|
59
|
-
format_max = 255
|
|
60
|
-
else:
|
|
61
|
-
format_max = 1
|
|
62
|
-
return 1, f"{_FORMAT_FROM_LENGTH[format_length]}{format_max}"
|
|
63
|
-
|
|
64
|
-
assert color.ndim == 2
|
|
65
|
-
|
|
66
|
-
_, format_ = NColorsAndFormat(color[0, :])
|
|
67
|
-
return color.shape[0], format_
|
|
68
|
-
|
|
69
|
-
raise ValueError(f"Unknown color format {color}.")
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def NewConvertedColor(
|
|
73
|
-
color: h.Any | h.Sequence[h.Any],
|
|
74
|
-
format_color: h.Literal["hex", "rgb1", "rgb255"],
|
|
75
|
-
/,
|
|
76
|
-
*,
|
|
77
|
-
sequence_or_reduction: (
|
|
78
|
-
int | h.Literal["min", "mean", "median", "max"] | type | h.Callable | None
|
|
79
|
-
) = None,
|
|
80
|
-
) -> h.Any:
|
|
81
|
-
""""""
|
|
82
|
-
# TODO: Full implementation, i.e. including with several colors output.
|
|
83
|
-
if format_color == "rgb1":
|
|
84
|
-
AsOutputFormat = AsRGB1
|
|
85
|
-
elif format_color == "rgb255":
|
|
86
|
-
AsOutputFormat = AsRGB255
|
|
87
|
-
elif format_color == "hex":
|
|
88
|
-
AsOutputFormat = AsHex
|
|
89
|
-
else:
|
|
90
|
-
raise ValueError(f"Unknown output format {format_color}.")
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
(not isinstance(color, str))
|
|
94
|
-
and (isinstance(color, h.Sequence) and isinstance(color[0], h.Sequence))
|
|
95
|
-
) or (isinstance(color, array_t) and (color.ndim == 2)):
|
|
96
|
-
# Notes: The first h.Sequence is implicitly tuple | list, or other "true" (i.e.
|
|
97
|
-
# not str) sequence types, and color can be of any length.
|
|
98
|
-
# The second h.Sequence is implicitly tuple | list, other "true" sequence types,
|
|
99
|
-
# or str. If str and the color is in Hex format, its length is either 4 (e.g.,
|
|
100
|
-
# #RGB <=> #RRGGBB), 5 (e.g., #RGBA <=> #RRGGBBAA), 7 (e.g., #RRGGBB) or 9
|
|
101
|
-
# (e.g., #RRGGBBAA). If not str, then color is a sequence of 3 or 4 integers in
|
|
102
|
-
# [0, 255] or floats in [0, 1].
|
|
103
|
-
if isinstance(sequence_or_reduction, int):
|
|
104
|
-
return AsOutputFormat(color[sequence_or_reduction])
|
|
105
|
-
elif isinstance(sequence_or_reduction, str):
|
|
106
|
-
raise NotImplementedError
|
|
107
|
-
return sequence_or_reduction(tuple(AsOutputFormat(_) for _ in color))
|
|
108
|
-
|
|
109
|
-
return AsOutputFormat(color)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"""
|
|
113
|
-
COPYRIGHT NOTICE
|
|
114
|
-
|
|
115
|
-
This software is governed by the CeCILL license under French law and
|
|
116
|
-
abiding by the rules of distribution of free software. You can use,
|
|
117
|
-
modify and/ or redistribute the software under the terms of the CeCILL
|
|
118
|
-
license as circulated by CEA, CNRS and INRIA at the following URL
|
|
119
|
-
"http://www.cecill.info".
|
|
120
|
-
|
|
121
|
-
As a counterpart to the access to the source code and rights to copy,
|
|
122
|
-
modify and redistribute granted by the license, users are provided only
|
|
123
|
-
with a limited warranty and the software's author, the holder of the
|
|
124
|
-
economic rights, and the successive licensors have only limited
|
|
125
|
-
liability.
|
|
126
|
-
|
|
127
|
-
In this respect, the user's attention is drawn to the risks associated
|
|
128
|
-
with loading, using, modifying and/or developing or reproducing the
|
|
129
|
-
software by the user in light of its specific status of free software,
|
|
130
|
-
that may mean that it is complicated to manipulate, and that also
|
|
131
|
-
therefore means that it is reserved for developers and experienced
|
|
132
|
-
professionals having in-depth computer knowledge. Users are therefore
|
|
133
|
-
encouraged to load and test the software's suitability as regards their
|
|
134
|
-
requirements in conditions enabling the security of their systems and/or
|
|
135
|
-
data to be ensured and, more generally, to use and operate it in the
|
|
136
|
-
same conditions as regards security.
|
|
137
|
-
|
|
138
|
-
The fact that you are presently reading this means that you have had
|
|
139
|
-
knowledge of the CeCILL license and that you accept its terms.
|
|
140
|
-
|
|
141
|
-
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
|
142
|
-
|
|
143
|
-
This software is being developed by Eric Debreuve, a CNRS employee and
|
|
144
|
-
member of team Morpheme.
|
|
145
|
-
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
|
146
|
-
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
|
147
|
-
I3S, and Laboratory iBV.
|
|
148
|
-
|
|
149
|
-
CNRS: https://www.cnrs.fr/index.php/en
|
|
150
|
-
Inria: https://www.inria.fr/en/
|
|
151
|
-
UniCA: https://univ-cotedazur.eu/
|
|
152
|
-
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
|
153
|
-
I3S: https://www.i3s.unice.fr/en/
|
|
154
|
-
iBV: http://ibv.unice.fr/
|
|
155
|
-
Team Morpheme: https://team.inria.fr/morpheme/
|
|
156
|
-
"""
|
|
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
|
|
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
|