lets-plot 4.6.0a2__cp312-cp312-macosx_11_0_arm64.whl → 4.6.0rc1__cp312-cp312-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 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
- plot_spec: Dict,
54
- sizing_options: Dict,
55
- *,
56
- dynamic_script_loading: bool = False,
57
- force_immediate_render: bool = False,
58
- responsive: bool = False
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 with customizable options.
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
- If True, loads JS library dynamically; if False, expects static loading.
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 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)
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
@@ -3,4 +3,4 @@
3
3
  # Use of this source code is governed by the MIT license that can be found in the LICENSE file.
4
4
  #
5
5
  # see: https://www.python.org/dev/peps/pep-0440/#developmental-releases
6
- __version__ = '4.6.0alpha2'
6
+ __version__ = '4.6.0rc1'