lets-plot 4.4.0rc1__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 4.5.0__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.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.

Files changed (39) hide show
  1. lets_plot/__init__.py +1 -1
  2. lets_plot/_type_utils.py +9 -4
  3. lets_plot/_version.py +1 -1
  4. lets_plot/bistro/corr.py +8 -1
  5. lets_plot/bistro/joint.py +7 -1
  6. lets_plot/bistro/qq.py +30 -3
  7. lets_plot/bistro/residual.py +6 -0
  8. lets_plot/bistro/waterfall.py +13 -5
  9. lets_plot/export/ggsave_.py +21 -1
  10. lets_plot/package_data/lets-plot.min.js +1 -1
  11. lets_plot/plot/__init__.py +3 -1
  12. lets_plot/plot/annotation.py +2 -2
  13. lets_plot/plot/core.py +11 -5
  14. lets_plot/plot/expand_limits_.py +78 -0
  15. lets_plot/plot/facet.py +9 -5
  16. lets_plot/plot/geom.py +710 -203
  17. lets_plot/plot/geom_function_.py +13 -3
  18. lets_plot/plot/geom_imshow_.py +1 -0
  19. lets_plot/plot/geom_livemap_.py +32 -0
  20. lets_plot/plot/gggrid_.py +5 -4
  21. lets_plot/plot/ggtb_.py +46 -1
  22. lets_plot/plot/guide.py +11 -1
  23. lets_plot/plot/label.py +2 -2
  24. lets_plot/plot/sampling.py +14 -4
  25. lets_plot/plot/scale.py +40 -40
  26. lets_plot/plot/scale_colormap_mpl.py +6 -4
  27. lets_plot/plot/scale_identity_.py +11 -19
  28. lets_plot/plot/scale_position.py +14 -14
  29. lets_plot/plot/stat.py +44 -4
  30. lets_plot/plot/subplots.py +1 -1
  31. lets_plot/plot/theme_.py +93 -13
  32. lets_plot/plot/tooltip.py +3 -3
  33. lets_plot/tilesets.py +4 -69
  34. {lets_plot-4.4.0rc1.dist-info → lets_plot-4.5.0.dist-info}/METADATA +37 -42
  35. {lets_plot-4.4.0rc1.dist-info → lets_plot-4.5.0.dist-info}/RECORD +39 -38
  36. {lets_plot-4.4.0rc1.dist-info → lets_plot-4.5.0.dist-info}/WHEEL +1 -1
  37. lets_plot_kotlin_bridge.cpython-312-aarch64-linux-gnu.so +0 -0
  38. {lets_plot-4.4.0rc1.dist-info → lets_plot-4.5.0.dist-info}/LICENSE +0 -0
  39. {lets_plot-4.4.0rc1.dist-info → lets_plot-4.5.0.dist-info}/top_level.txt +0 -0
lets_plot/__init__.py CHANGED
@@ -108,7 +108,7 @@ class LetsPlot:
108
108
  def set(cls, settings: Dict):
109
109
  """
110
110
  Set up library options.
111
- For more info see https://lets-plot.org/python/pages/basemap_tiles.html#configuring-globally.
111
+ For more info see `Configuring Globally <https://lets-plot.org/python/pages/basemap_tiles.html#configuring-globally>`__.
112
112
 
113
113
  Parameters
114
114
  ----------
lets_plot/_type_utils.py CHANGED
@@ -29,6 +29,11 @@ try:
29
29
  except ImportError:
30
30
  shapely = None
31
31
 
32
+ try:
33
+ import jax.numpy as jnp
34
+ except ImportError:
35
+ jnp = None
36
+
32
37
 
33
38
  # Parameter 'value' can also be pandas.DataFrame
34
39
  def standardize_dict(value: Dict) -> Dict:
@@ -52,15 +57,15 @@ def is_dict_or_dataframe(v):
52
57
 
53
58
 
54
59
  def is_int(v):
55
- return isinstance(v, int) or (numpy and isinstance(v, numpy.integer))
60
+ return isinstance(v, int) or (numpy and isinstance(v, numpy.integer)) or (jnp and isinstance(v, jnp.integer))
56
61
 
57
62
 
58
63
  def is_float(v):
59
- return isinstance(v, float) or (numpy and isinstance(v, numpy.floating))
64
+ return isinstance(v, float) or (numpy and isinstance(v, numpy.floating)) or (jnp and isinstance(v, jnp.floating))
60
65
 
61
66
 
62
67
  def is_ndarray(data) -> bool:
63
- return numpy and isinstance(data, numpy.ndarray)
68
+ return (numpy and isinstance(data, numpy.ndarray)) or (jnp and isinstance(data, jnp.ndarray))
64
69
 
65
70
 
66
71
  def is_number(v):
@@ -90,7 +95,7 @@ def _standardize_value(v):
90
95
  return [_standardize_value(elem) for elem in v]
91
96
  if isinstance(v, tuple):
92
97
  return tuple(_standardize_value(elem) for elem in v)
93
- if (numpy and isinstance(v, numpy.ndarray)) or (pandas and isinstance(v, pandas.Series)):
98
+ if (numpy and isinstance(v, numpy.ndarray)) or (pandas and isinstance(v, pandas.Series)) or (jnp and isinstance(v, jnp.ndarray)):
94
99
  return _standardize_value(v.tolist())
95
100
  if isinstance(v, datetime):
96
101
  if pandas and v is pandas.NaT:
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.4.0rc1'
6
+ __version__ = '4.5.0'
lets_plot/bistro/corr.py CHANGED
@@ -68,6 +68,11 @@ class corr_plot:
68
68
  """
69
69
  This class is intended to build correlation matrix plot.
70
70
 
71
+ Notes
72
+ -----
73
+ To hide axis tooltips, set 'blank' or the result of `element_blank()`
74
+ to the `axis_tooltip`, `axis_tooltip_x` or `axis_tooltip_y` parameter of the `theme()`.
75
+
71
76
  Examples
72
77
  --------
73
78
  .. jupyter-execute::
@@ -204,7 +209,9 @@ class corr_plot:
204
209
  If True, then absolute value of correlation is mapped to text size.
205
210
  If False - the text size is constant. Default - contextual.
206
211
  color : str
207
- Set text color. Default - contextual.
212
+ Set text color.
213
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
214
+ Default - contextual.
208
215
 
209
216
  Returns
210
217
  -------
lets_plot/bistro/joint.py CHANGED
@@ -64,6 +64,7 @@ def joint_plot(data, x, y, *,
64
64
  Applicable simultaneously for 'tile' geom and 'histogram' marginal.
65
65
  color : str
66
66
  Color of the geometry.
67
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
67
68
  size : float
68
69
  Size of the geometry.
69
70
  alpha : float
@@ -76,7 +77,7 @@ def joint_plot(data, x, y, *,
76
77
  True - show the line of linear regression.
77
78
  se : bool, default=True
78
79
  Display confidence interval around regression line.
79
- marginal : str, default='dens:r'
80
+ marginal : str
80
81
  Description of marginal layers packed to string value.
81
82
  Different marginals are separated by the ',' char.
82
83
  Parameters of a marginal are separated by the ':' char.
@@ -96,6 +97,11 @@ def joint_plot(data, x, y, *,
96
97
  `PlotSpec`
97
98
  Plot object specification.
98
99
 
100
+ Notes
101
+ -----
102
+ To hide axis tooltips, set 'blank' or the result of `element_blank()`
103
+ to the `axis_tooltip`, `axis_tooltip_x` or `axis_tooltip_y` parameter of the `theme()`.
104
+
99
105
  Examples
100
106
  --------
101
107
  .. jupyter-execute::
lets_plot/bistro/qq.py CHANGED
@@ -10,6 +10,7 @@ def qq_plot(data=None, sample=None, *, x=None, y=None,
10
10
  distribution=None, dparams=None, quantiles=None,
11
11
  group=None,
12
12
  show_legend=None,
13
+ marginal=None,
13
14
  color=None, fill=None, alpha=None, size=None, shape=None,
14
15
  line_color=None, line_size=None, linetype=None) -> PlotSpec:
15
16
  """
@@ -49,24 +50,44 @@ def qq_plot(data=None, sample=None, *, x=None, y=None,
49
50
  If it is specified and color-parameters isn't then different groups will has different colors.
50
51
  show_legend : bool, default=True
51
52
  False - do not show legend.
53
+ marginal : str, default='dens:tr'
54
+ Description of marginal layers packed to string value.
55
+ Different marginals are separated by the ',' char.
56
+ Parameters of a marginal are separated by the ':' char.
57
+ First parameter of a marginal is a geometry name.
58
+ Possible values: 'dens'/'density', 'hist'/'histogram', 'box'/'boxplot'.
59
+ Second parameter is a string specifying which sides of the plot the marginal layer will appear on.
60
+ Possible values: 't' (top), 'b' (bottom), 'l' (left), 'r' (right).
61
+ Third parameter (optional) is size of marginal.
62
+ To suppress marginals use `marginal='none'`.
63
+ Examples:
64
+ "hist:tr:0.3",
65
+ "dens:tr,hist:bl",
66
+ "box : tr : .05, dens : bl".
52
67
  color : str
53
68
  Color of a points.
69
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
54
70
  fill : str
55
71
  Color to paint shape's inner points. Is applied only to the points of shapes having inner points.
72
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
56
73
  alpha : float, default=0.5
57
74
  Transparency level of points. Accept values between 0 and 1.
58
75
  size : float, default=3.0
59
76
  Size of the points.
60
77
  shape : int
61
78
  Shape of the points, an integer from 0 to 25.
79
+ For more info see `Point Shapes <https://lets-plot.org/python/pages/aesthetics.html#point-shapes>`__.
62
80
  line_color : str, default='#FF0000'
63
81
  Color of the fitting line.
82
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
64
83
  line_size : float, default=0.75
65
84
  Width of the fitting line.
66
- linetype : int or str
85
+ linetype : int or str or list
67
86
  Type of the fitting line.
68
- Codes and names: 0 = 'blank', 1 = 'solid', 2 = 'dashed',
69
- 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'.
87
+ Accept codes or names (0 = 'blank', 1 = 'solid', 2 = 'dashed', 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'),
88
+ a hex string (up to 8 digits for dash-gap lengths),
89
+ or a list pattern [offset, [dash, gap, ...]] / [dash, gap, ...].
90
+ For more info see `Line Types <https://lets-plot.org/python/pages/aesthetics.html#line-types>`__.
70
91
 
71
92
  Returns
72
93
  -------
@@ -81,6 +102,11 @@ def qq_plot(data=None, sample=None, *, x=None, y=None,
81
102
  If the two distributions being compared are similar, the points in the Q-Q plot
82
103
  will approximately lie on the straight line.
83
104
 
105
+ ----
106
+
107
+ To hide axis tooltips, set 'blank' or the result of `element_blank()`
108
+ to the `axis_tooltip`, `axis_tooltip_x` or `axis_tooltip_y` parameter of the `theme()`.
109
+
84
110
  Examples
85
111
  --------
86
112
  .. jupyter-execute::
@@ -169,6 +195,7 @@ def qq_plot(data=None, sample=None, *, x=None, y=None,
169
195
  'quantiles': quantiles,
170
196
  'group': group,
171
197
  'show_legend': show_legend,
198
+ 'marginal': marginal,
172
199
  'color': color,
173
200
  'fill': fill,
174
201
  'alpha': alpha,
@@ -178,6 +178,7 @@ def residual_plot(data=None, x=None, y=None, *,
178
178
  Applicable simultaneously for 'tile' geom and 'histogram' marginal.
179
179
  color : str
180
180
  Color of the geometry.
181
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
181
182
  size : float
182
183
  Size of the geometry.
183
184
  alpha : float
@@ -213,6 +214,11 @@ def residual_plot(data=None, x=None, y=None, *,
213
214
  When using 'lm' and 'loess' methods,
214
215
  this function requires the `statsmodels` and `scipy` libraries to be installed.
215
216
 
217
+ ----
218
+
219
+ To hide axis tooltips, set 'blank' or the result of `element_blank()`
220
+ to the `axis_tooltip`, `axis_tooltip_x` or `axis_tooltip_y` parameter of the `theme()`.
221
+
216
222
  Examples
217
223
  --------
218
224
  .. jupyter-execute::
@@ -12,6 +12,7 @@ def waterfall_plot(data, x, y, *,
12
12
  width=None,
13
13
  show_legend=None, relative_tooltips=None, absolute_tooltips=None,
14
14
  sorted_value=None, threshold=None, max_values=None,
15
+ base=None,
15
16
  calc_total=None, total_title=None,
16
17
  hline=None, hline_ontop=None,
17
18
  connector=None,
@@ -24,7 +25,7 @@ def waterfall_plot(data, x, y, *,
24
25
  data : dict or Pandas or Polars `DataFrame`
25
26
  The data to be displayed.
26
27
  x : str
27
- Name of a variable. All values should be distinct.
28
+ Name of a variable.
28
29
  y : str
29
30
  Name of a numeric variable.
30
31
  measure : str
@@ -39,18 +40,22 @@ def waterfall_plot(data, x, y, *,
39
40
  Grouping variable. Each group calculates its own statistics.
40
41
  color : str
41
42
  Color of the box boundary lines.
43
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
42
44
  Use 'flow_type' to color lines by the direction of the flow.
43
45
  fill : str
44
46
  Fill color of the boxes.
47
+ For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
45
48
  Use 'flow_type' to color boxes by the direction of the flow.
46
49
  size : float, default=0.0
47
50
  Line width of the box boundary lines.
48
51
  alpha : float
49
52
  Transparency level of the boxes. Accept values between 0 and 1.
50
- linetype : int or str
53
+ linetype : int or str or list
51
54
  Type of the box boundary lines.
52
- Codes and names: 0 = 'blank', 1 = 'solid', 2 = 'dashed',
53
- 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'.
55
+ Accept codes or names (0 = 'blank', 1 = 'solid', 2 = 'dashed', 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'),
56
+ a hex string (up to 8 digits for dash-gap lengths),
57
+ or a list pattern [offset, [dash, gap, ...]] / [dash, gap, ...].
58
+ For more info see `Line Types <https://lets-plot.org/python/pages/aesthetics.html#line-types>`__.
54
59
  width : float, default=0.9
55
60
  Width of the boxes. Typically range between 0 and 1.
56
61
  Values that are greater than 1 lead to overlapping of the boxes.
@@ -74,6 +79,8 @@ def waterfall_plot(data, x, y, *,
74
79
  Groups all categories under a certain threshold value into "Other" category.
75
80
  max_values : int
76
81
  Groups all categories with the smallest changes, except the first `max_values`, into "Other" category.
82
+ base : float, default=0.0
83
+ Values with measure 'absolute' or 'total' are relative to this value.
77
84
  calc_total : bool, default=True
78
85
  Setting the `calc_total` to True will put the final cumulative sum into a new separate box.
79
86
  Taken into account only if the 'measure' column isn't provided.
@@ -103,7 +110,7 @@ def waterfall_plot(data, x, y, *,
103
110
  - 'Num {}' -> 'Num 12.456789'
104
111
  - 'TTL: {.2f}$' -> 'TTL: 12.45$'
105
112
 
106
- For more info see https://lets-plot.org/python/pages/formats.html.
113
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
107
114
 
108
115
  Returns
109
116
  -------
@@ -232,6 +239,7 @@ def waterfall_plot(data, x, y, *,
232
239
  'sorted_value': sorted_value,
233
240
  'threshold': threshold,
234
241
  'max_values': max_values,
242
+ 'base': base,
235
243
  'calc_total': calc_total,
236
244
  'total_title': total_title,
237
245
  'hline': hline,
@@ -34,7 +34,7 @@ def ggsave(plot: Union[PlotSpec, SupPlotsSpec, GGBunch], filename: str, *, path:
34
34
  to one of the supported formats: SVG, HTML (or HTM), PNG (requires CairoSVG library), PDF.
35
35
  path : str
36
36
  Path to a directory to save image files in.
37
- By default it is ${user.dir}/lets-plot-images.
37
+ By default, it is ${user.dir}/lets-plot-images.
38
38
  iframe : bool, default=True
39
39
  Whether to wrap HTML page into a iFrame.
40
40
  Only applicable when exporting to HTML.
@@ -60,6 +60,26 @@ def ggsave(plot: Union[PlotSpec, SupPlotsSpec, GGBunch], filename: str, *, path:
60
60
  str
61
61
  Absolute pathname of created file.
62
62
 
63
+ Notes
64
+ -----
65
+ Output format is inferred from the filename extension.
66
+
67
+ For PNG and PDF formats:
68
+
69
+ 1. If `w`, `h`, `unit`, and `dpi` are all specified:
70
+
71
+ - `scale` is ignored.
72
+ - The plot's pixel size (default or set by `ggsize()`) is converted to the specified units using the given dpi.
73
+ - If the aspect ratio of `w` and `h` differs from the plot's pixel aspect ratio:
74
+
75
+ * The plot maintains its original (pixel) aspect ratio.
76
+ * It's fitted within the specified `w` x `h` area.
77
+ * Any extra space is left empty.
78
+
79
+ 2. If `w`, `h` are not specified:
80
+
81
+ - The `scale` parameter is used to determine the output size.
82
+
63
83
  Examples
64
84
  --------
65
85
  .. code-block::