lets-plot 4.5.3a1__cp310-cp310-win_amd64.whl → 4.6.0a1__cp310-cp310-win_amd64.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.
Potentially problematic release.
This version of lets-plot might be problematic. Click here for more details.
- lets_plot/_kbridge.py +71 -0
- lets_plot/_version.py +1 -1
- lets_plot/bistro/_plot2d_common.py +7 -0
- lets_plot/bistro/im.py +38 -7
- lets_plot/bistro/joint.py +3 -3
- lets_plot/bistro/residual.py +3 -3
- lets_plot/package_data/lets-plot.min.js +2 -2
- lets_plot/plot/__init__.py +2 -0
- lets_plot/plot/core.py +1 -1
- lets_plot/plot/geom.py +248 -61
- lets_plot/plot/ggbunch_.py +96 -0
- lets_plot/plot/gggrid_.py +3 -18
- lets_plot/plot/plot.py +7 -0
- lets_plot/plot/scale.py +45 -20
- lets_plot/plot/subplots.py +1 -1
- lets_plot/plot/subplots_util.py +24 -0
- lets_plot/plot/theme_.py +12 -12
- {lets_plot-4.5.3a1.dist-info → lets_plot-4.6.0a1.dist-info}/METADATA +16 -3
- {lets_plot-4.5.3a1.dist-info → lets_plot-4.6.0a1.dist-info}/RECORD +23 -21
- {lets_plot-4.5.3a1.dist-info → lets_plot-4.6.0a1.dist-info}/WHEEL +1 -1
- lets_plot_kotlin_bridge.cp310-win_amd64.pyd +0 -0
- {lets_plot-4.5.3a1.dist-info → lets_plot-4.6.0a1.dist-info}/LICENSE +0 -0
- {lets_plot-4.5.3a1.dist-info → lets_plot-4.6.0a1.dist-info}/top_level.txt +0 -0
lets_plot/_kbridge.py
CHANGED
|
@@ -34,3 +34,74 @@ def _standardize_plot_spec(plot_spec: Dict) -> Dict:
|
|
|
34
34
|
raise ValueError("dict expected but was {}".format(type(plot_spec)))
|
|
35
35
|
|
|
36
36
|
return standardize_dict(plot_spec)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _generate_static_configure_html() -> str:
|
|
40
|
+
"""
|
|
41
|
+
Generate static HTML configuration.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
str
|
|
46
|
+
HTML string containing the static configuration with the script URL from global settings.
|
|
47
|
+
"""
|
|
48
|
+
scriptUrl = get_js_cdn_url()
|
|
49
|
+
return lets_plot_kotlin_bridge.get_static_configure_html(scriptUrl)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _generate_display_html_for_raw_spec(
|
|
53
|
+
plot_spec: Dict,
|
|
54
|
+
sizing_options: Dict,
|
|
55
|
+
*,
|
|
56
|
+
dynamic_script_loading: bool = False,
|
|
57
|
+
force_immediate_render: bool = False,
|
|
58
|
+
responsive: bool = False
|
|
59
|
+
) -> str:
|
|
60
|
+
"""
|
|
61
|
+
Generate HTML for displaying a plot from raw specification with customizable options.
|
|
62
|
+
|
|
63
|
+
Parameters
|
|
64
|
+
----------
|
|
65
|
+
plot_spec : Dict
|
|
66
|
+
Dict containing the plot specification.
|
|
67
|
+
sizing_options : Dict
|
|
68
|
+
Dict containing sizing policy options (width_mode, height_mode, width, height).
|
|
69
|
+
dynamic_script_loading : bool, default=False
|
|
70
|
+
If True, loads JS library dynamically; if False, expects static loading.
|
|
71
|
+
force_immediate_render : bool, default=False
|
|
72
|
+
If True, forces immediate plot rendering.
|
|
73
|
+
responsive : bool, default=False
|
|
74
|
+
If True, makes the plot responsive to container size changes.
|
|
75
|
+
|
|
76
|
+
Returns
|
|
77
|
+
-------
|
|
78
|
+
str
|
|
79
|
+
HTML string containing the plot with specified options.
|
|
80
|
+
|
|
81
|
+
Notes
|
|
82
|
+
-----
|
|
83
|
+
The sizing_options dict supports the following keys:
|
|
84
|
+
- width_mode : str
|
|
85
|
+
One of: 'fit', 'min', 'scaled', 'fixed'
|
|
86
|
+
- height_mode : str
|
|
87
|
+
One of: 'fit', 'min', 'scaled', 'fixed'
|
|
88
|
+
- width : number, optional
|
|
89
|
+
The width value (used with 'fixed' mode).
|
|
90
|
+
- height : number, optional
|
|
91
|
+
The height value (used with 'fixed' mode).
|
|
92
|
+
|
|
93
|
+
The modes determine how the plot dimensions are computed:
|
|
94
|
+
- 'fit': uses the container dimension
|
|
95
|
+
- 'min': uses the smaller of plot's own dimension or container dimension
|
|
96
|
+
- 'scaled': computes dimension to preserve plot's aspect ratio
|
|
97
|
+
- 'fixed': uses plot's own dimension (non-responsive)
|
|
98
|
+
"""
|
|
99
|
+
plot_spec = _standardize_plot_spec(plot_spec)
|
|
100
|
+
sizing_options = standardize_dict(sizing_options)
|
|
101
|
+
return lets_plot_kotlin_bridge.get_display_html_for_raw_spec(
|
|
102
|
+
plot_spec,
|
|
103
|
+
sizing_options,
|
|
104
|
+
dynamic_script_loading,
|
|
105
|
+
force_immediate_render,
|
|
106
|
+
responsive
|
|
107
|
+
)
|
lets_plot/_version.py
CHANGED
|
@@ -36,6 +36,13 @@ def _get_geom2d_layer(geom_kind, binwidth2d, bins2d, color, color_by, size, alph
|
|
|
36
36
|
color=color, size=size, alpha=alpha,
|
|
37
37
|
show_legend=show_legend
|
|
38
38
|
)
|
|
39
|
+
if geom_kind == 'hex':
|
|
40
|
+
return geom_hex(
|
|
41
|
+
aes(fill=('..count..' if color_by is None else color_by)),
|
|
42
|
+
bins=bins2d, binwidth=binwidth2d,
|
|
43
|
+
color=color, size=size, alpha=alpha,
|
|
44
|
+
show_legend=show_legend
|
|
45
|
+
)
|
|
39
46
|
if geom_kind == 'density2d':
|
|
40
47
|
return geom_density2d(
|
|
41
48
|
aes(color=('..group..' if color_by is None else color_by)),
|
lets_plot/bistro/im.py
CHANGED
|
@@ -6,14 +6,23 @@ from typing import Any
|
|
|
6
6
|
|
|
7
7
|
from lets_plot._type_utils import is_ndarray
|
|
8
8
|
from lets_plot.plot.geom_imshow_ import geom_imshow
|
|
9
|
-
from lets_plot.plot.
|
|
9
|
+
from lets_plot.plot.ggbunch_ import ggbunch
|
|
10
|
+
from lets_plot.plot.plot import ggplot, ggsize, GGBunch
|
|
10
11
|
from lets_plot.plot.scale_position import scale_x_continuous, scale_y_continuous
|
|
12
|
+
from lets_plot.plot.subplots import SupPlotsSpec
|
|
11
13
|
from lets_plot.plot.theme_ import theme
|
|
12
14
|
|
|
13
15
|
__all__ = ['image_matrix']
|
|
14
16
|
|
|
15
17
|
|
|
16
|
-
def image_matrix(image_data_array,
|
|
18
|
+
def image_matrix(image_data_array,
|
|
19
|
+
cmap=None, *,
|
|
20
|
+
norm=None,
|
|
21
|
+
vmin=None,
|
|
22
|
+
vmax=None,
|
|
23
|
+
scale=1,
|
|
24
|
+
spacer=1,
|
|
25
|
+
) -> SupPlotsSpec:
|
|
17
26
|
"""
|
|
18
27
|
Display a set of images in a grid.
|
|
19
28
|
Dimensions of the grid are determined by the shape of the input Numpy 2D array.
|
|
@@ -39,6 +48,8 @@ def image_matrix(image_data_array, cmap=None, *, norm=None, vmin=None, vmax=None
|
|
|
39
48
|
This parameter is ignored for RGB(A) images or if parameter `norm=False`.
|
|
40
49
|
scale : float, default=1.0
|
|
41
50
|
Specify the image size magnification factor.
|
|
51
|
+
spacer : number, default=1
|
|
52
|
+
Specify the number of pixels between images.
|
|
42
53
|
|
|
43
54
|
Returns
|
|
44
55
|
-------
|
|
@@ -111,13 +122,21 @@ def image_matrix(image_data_array, cmap=None, *, norm=None, vmin=None, vmax=None
|
|
|
111
122
|
options = scale_x_continuous(expand=[0, 0])
|
|
112
123
|
options += scale_y_continuous(expand=[0, 0])
|
|
113
124
|
|
|
114
|
-
#
|
|
115
|
-
options += theme(
|
|
125
|
+
# clear all plot decorations, reset plot margins
|
|
126
|
+
options += theme(axis='blank', panel_grid='blank')
|
|
127
|
+
options += theme(plot_inset=0, plot_margin=0, panel_inset=0)
|
|
116
128
|
|
|
117
|
-
|
|
129
|
+
figures = []
|
|
130
|
+
regions = []
|
|
131
|
+
|
|
132
|
+
bunch_width = cols * w_max + (cols - 1) * spacer
|
|
133
|
+
bunch_height = rows * h_max + (rows - 1) * spacer
|
|
118
134
|
|
|
119
135
|
for row in range(rows):
|
|
120
136
|
for col in range(cols):
|
|
137
|
+
figures.append(None)
|
|
138
|
+
regions.append((0, 0, 0, 0))
|
|
139
|
+
|
|
121
140
|
image_data = image_data_array[row][col]
|
|
122
141
|
if image_data is None:
|
|
123
142
|
continue
|
|
@@ -133,9 +152,21 @@ def image_matrix(image_data_array, cmap=None, *, norm=None, vmin=None, vmax=None
|
|
|
133
152
|
show_legend=False
|
|
134
153
|
)
|
|
135
154
|
p += options
|
|
136
|
-
|
|
155
|
+
figures[len(figures) - 1] = p
|
|
156
|
+
regions[len(figures) - 1] = (
|
|
157
|
+
col * (w_max + spacer) / bunch_width,
|
|
158
|
+
row * (h_max + spacer) / bunch_height,
|
|
159
|
+
w / bunch_width,
|
|
160
|
+
h / bunch_height
|
|
161
|
+
)
|
|
137
162
|
|
|
138
|
-
return ggbunch
|
|
163
|
+
return ggbunch(
|
|
164
|
+
plots=figures,
|
|
165
|
+
regions=regions
|
|
166
|
+
) + ggsize(
|
|
167
|
+
bunch_width,
|
|
168
|
+
bunch_height
|
|
169
|
+
)
|
|
139
170
|
|
|
140
171
|
|
|
141
172
|
def _assert_image_data(image_data: Any) -> None:
|
lets_plot/bistro/joint.py
CHANGED
|
@@ -51,17 +51,17 @@ def joint_plot(data, x, y, *,
|
|
|
51
51
|
The data to be displayed.
|
|
52
52
|
x, y : str
|
|
53
53
|
Names of a variables.
|
|
54
|
-
geom : {'point', 'tile', 'density2d', 'density2df'}, default='point'
|
|
54
|
+
geom : {'point', 'tile', 'hex', 'density2d', 'density2df'}, default='point'
|
|
55
55
|
The geometric object to use to display the data.
|
|
56
56
|
bins : int or list of int
|
|
57
57
|
Number of bins in both directions, vertical and horizontal. Overridden by `binwidth`.
|
|
58
58
|
If only one value given - interpret it as list of two equal values.
|
|
59
|
-
Applicable simultaneously for 'tile' geom and 'histogram' marginal.
|
|
59
|
+
Applicable simultaneously for 'tile'/'hex' geom and 'histogram' marginal.
|
|
60
60
|
binwidth : float or list of float
|
|
61
61
|
The width of the bins in both directions, vertical and horizontal.
|
|
62
62
|
Overrides `bins`. The default is to use bin widths that cover the entire range of the data.
|
|
63
63
|
If only one value given - interpret it as list of two equal values.
|
|
64
|
-
Applicable simultaneously for 'tile' geom and 'histogram' marginal.
|
|
64
|
+
Applicable simultaneously for 'tile'/'hex' geom and 'histogram' marginal.
|
|
65
65
|
color : str
|
|
66
66
|
Color of the geometry.
|
|
67
67
|
For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|
lets_plot/bistro/residual.py
CHANGED
|
@@ -165,17 +165,17 @@ def residual_plot(data=None, x=None, y=None, *,
|
|
|
165
165
|
Random seed for 'loess' sampling.
|
|
166
166
|
max_n : int
|
|
167
167
|
Maximum number of data-points for 'loess' method. If this quantity exceeded random sampling is applied to data.
|
|
168
|
-
geom : {'point', 'tile', 'density2d', 'density2df', 'none'}, default='point'
|
|
168
|
+
geom : {'point', 'tile', 'hex', 'density2d', 'density2df', 'none'}, default='point'
|
|
169
169
|
The geometric object to use to display the data. No object will be used if `geom='none'`.
|
|
170
170
|
bins : int or list of int
|
|
171
171
|
Number of bins in both directions, vertical and horizontal. Overridden by `binwidth`.
|
|
172
172
|
If only one value given - interpret it as list of two equal values.
|
|
173
|
-
Applicable simultaneously for 'tile' geom and 'histogram' marginal.
|
|
173
|
+
Applicable simultaneously for 'tile'/'hex' geom and 'histogram' marginal.
|
|
174
174
|
binwidth : float or list of float
|
|
175
175
|
The width of the bins in both directions, vertical and horizontal.
|
|
176
176
|
Overrides `bins`. The default is to use bin widths that cover the entire range of the data.
|
|
177
177
|
If only one value given - interpret it as list of two equal values.
|
|
178
|
-
Applicable simultaneously for 'tile' geom and 'histogram' marginal.
|
|
178
|
+
Applicable simultaneously for 'tile'/'hex' geom and 'histogram' marginal.
|
|
179
179
|
color : str
|
|
180
180
|
Color of the geometry.
|
|
181
181
|
For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|