lets-plot 4.6.0a2__cp38-cp38-macosx_11_0_arm64.whl → 4.6.1__cp38-cp38-macosx_11_0_arm64.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 +52 -25
- lets_plot/_version.py +1 -1
- lets_plot/package_data/lets-plot.min.js +1 -1
- lets_plot/plot/geom.py +156 -42
- lets_plot/plot/pos.py +10 -3
- lets_plot/plot/scale.py +8 -8
- lets_plot/plot/theme_.py +93 -5
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.1.dist-info}/METADATA +19 -30
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.1.dist-info}/RECORD +13 -13
- lets_plot_kotlin_bridge.cpython-38-darwin.so +0 -0
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.1.dist-info}/LICENSE +0 -0
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.1.dist-info}/WHEEL +0 -0
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.1.dist-info}/top_level.txt +0 -0
lets_plot/_kbridge.py
CHANGED
|
@@ -6,8 +6,8 @@ from typing import Dict
|
|
|
6
6
|
|
|
7
7
|
import lets_plot_kotlin_bridge
|
|
8
8
|
|
|
9
|
-
from ._type_utils import standardize_dict
|
|
10
9
|
from ._global_settings import get_js_cdn_url
|
|
10
|
+
from ._type_utils import standardize_dict
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def _generate_dynamic_display_html(plot_spec: Dict) -> str:
|
|
@@ -50,15 +50,16 @@ def _generate_static_configure_html() -> str:
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
def _generate_display_html_for_raw_spec(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
59
|
) -> str:
|
|
60
60
|
"""
|
|
61
|
-
Generate HTML for displaying a plot from raw specification
|
|
61
|
+
Generate HTML for displaying a plot from 'raw' specification (not processed by plot backend)
|
|
62
|
+
with customizable options.
|
|
62
63
|
|
|
63
64
|
Parameters
|
|
64
65
|
----------
|
|
@@ -67,9 +68,14 @@ def _generate_display_html_for_raw_spec(
|
|
|
67
68
|
sizing_options : Dict
|
|
68
69
|
Dict containing sizing policy options (width_mode, height_mode, width, height).
|
|
69
70
|
dynamic_script_loading : bool, default=False
|
|
70
|
-
|
|
71
|
+
Controls how the generated JS code interacts with the lets-plot JS library.
|
|
72
|
+
If True, assumes the library will be loaded dynamically.
|
|
73
|
+
If False, assumes the library is already present in the page header (static loading).
|
|
71
74
|
force_immediate_render : bool, default=False
|
|
75
|
+
Controls the timing of plot rendering.
|
|
72
76
|
If True, forces immediate plot rendering.
|
|
77
|
+
If False, waits for ResizeObserver(JS) event and renders the plot after the plot
|
|
78
|
+
container is properly layouted in DOM.
|
|
73
79
|
responsive : bool, default=False
|
|
74
80
|
If True, makes the plot responsive to container size changes.
|
|
75
81
|
|
|
@@ -80,21 +86,42 @@ def _generate_display_html_for_raw_spec(
|
|
|
80
86
|
|
|
81
87
|
Notes
|
|
82
88
|
-----
|
|
83
|
-
The sizing_options dict supports the following
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
The sizing_options dict supports the following structure:
|
|
90
|
+
{
|
|
91
|
+
'width_mode': str, # 'fixed', 'min', 'fit', 'scaled' (case-insensitive)
|
|
92
|
+
'height_mode': str, # 'fixed', 'min', 'fit', 'scaled' (case-insensitive)
|
|
93
|
+
'width': number, # optional
|
|
94
|
+
'height': number # optional
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
Sizing modes determine how the plot dimensions are calculated:
|
|
98
|
+
|
|
99
|
+
1. FIXED mode:
|
|
100
|
+
- Uses the explicitly provided width/height values
|
|
101
|
+
- Falls back to the default figure size if no values provided
|
|
102
|
+
- Not responsive to container size
|
|
103
|
+
|
|
104
|
+
2. MIN mode:
|
|
105
|
+
Applies the smallest dimension among:
|
|
106
|
+
- The default figure size
|
|
107
|
+
- The specified width/height (if provided)
|
|
108
|
+
- The container size (if available)
|
|
109
|
+
|
|
110
|
+
3. FIT mode:
|
|
111
|
+
Uses either:
|
|
112
|
+
- The specified width/height if provided
|
|
113
|
+
- Otherwise uses container size if available
|
|
114
|
+
- Falls back to default figure size if neither is available
|
|
115
|
+
|
|
116
|
+
4. SCALED mode:
|
|
117
|
+
- Always preserves the figure's aspect ratio
|
|
118
|
+
- Typical usage: one dimension (usually width) uses FIXED/MIN/FIT mode
|
|
119
|
+
and SCALED height adjusts to maintain aspect ratio
|
|
120
|
+
- Special case: when both width and height are SCALED:
|
|
121
|
+
* Requires container size to be available
|
|
122
|
+
* Fits figure within container while preserving aspect ratio
|
|
123
|
+
* Neither dimension is predetermined
|
|
124
|
+
|
|
98
125
|
"""
|
|
99
126
|
plot_spec = _standardize_plot_spec(plot_spec)
|
|
100
127
|
sizing_options = standardize_dict(sizing_options)
|
|
@@ -104,4 +131,4 @@ def _generate_display_html_for_raw_spec(
|
|
|
104
131
|
dynamic_script_loading,
|
|
105
132
|
force_immediate_render,
|
|
106
133
|
responsive
|
|
107
|
-
)
|
|
134
|
+
)
|
lets_plot/_version.py
CHANGED