lets-plot 4.7.2rc1__cp39-cp39-macosx_10_15_x86_64.whl → 4.8.0rc1__cp39-cp39-macosx_10_15_x86_64.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 (29) hide show
  1. lets_plot/__init__.py +1 -1
  2. lets_plot/_version.py +1 -1
  3. lets_plot/bistro/_plot2d_common.py +6 -0
  4. lets_plot/bistro/joint.py +4 -4
  5. lets_plot/bistro/residual.py +1 -1
  6. lets_plot/export/ggsave_.py +35 -18
  7. lets_plot/package_data/lets-plot.min.js +1 -1
  8. lets_plot/plot/core.py +38 -7
  9. lets_plot/plot/facet.py +3 -3
  10. lets_plot/plot/geom.py +295 -16
  11. lets_plot/plot/geom_livemap_.py +8 -0
  12. lets_plot/plot/gggrid_.py +20 -7
  13. lets_plot/plot/ggtb_.py +28 -2
  14. lets_plot/plot/label.py +1 -1
  15. lets_plot/plot/pos.py +32 -8
  16. lets_plot/plot/scale_identity_.py +20 -16
  17. lets_plot/plot/theme_.py +18 -10
  18. lets_plot/plot/theme_set.py +39 -15
  19. lets_plot/plot/tooltip.py +1 -1
  20. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/METADATA +10 -6
  21. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/RECORD +29 -29
  22. lets_plot_kotlin_bridge.cpython-39-darwin.so +0 -0
  23. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/WHEEL +0 -0
  24. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/licenses/LICENSE +0 -0
  25. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/licenses/licenses/LICENSE.FreeType +0 -0
  26. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/licenses/licenses/LICENSE.ImageMagick +0 -0
  27. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/licenses/licenses/LICENSE.expat +0 -0
  28. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/licenses/licenses/LICENSE.fontconfig +0 -0
  29. {lets_plot-4.7.2rc1.dist-info → lets_plot-4.8.0rc1.dist-info}/top_level.txt +0 -0
lets_plot/__init__.py CHANGED
@@ -49,7 +49,7 @@ class LetsPlot:
49
49
  Parameters
50
50
  ----------
51
51
  isolated_frame : bool
52
- True - generate HTLM which can be used in iframe or in a standalone HTML document.
52
+ True - generate HTML which can be used in iframe or in a standalone HTML document.
53
53
  False - pre-load Lets-Plot JS library. Notebook cell output will only consist
54
54
  of HTML for the plot rendering. Default: None - auto-detect.
55
55
  offline : bool
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.7.2rc1'
6
+ __version__ = '4.8.0rc1'
@@ -55,6 +55,12 @@ def _get_geom2d_layer(geom_kind, binwidth2d, bins2d, color, color_by, size, alph
55
55
  color=color, size=size, alpha=alpha,
56
56
  show_legend=show_legend
57
57
  )
58
+ if geom_kind == 'pointdensity':
59
+ return geom_pointdensity(
60
+ aes(color=('..density..' if color_by is None else color_by)),
61
+ color=color, size=size, alpha=alpha,
62
+ show_legend=show_legend
63
+ )
58
64
  if geom_kind == 'none':
59
65
  return None
60
66
  raise Exception("Unknown geom '{0}'".format(geom_kind))
lets_plot/bistro/joint.py CHANGED
@@ -2,11 +2,11 @@
2
2
  # Copyright (c) 2023. JetBrains s.r.o.
3
3
  # Use of this source code is governed by the MIT license that can be found in the LICENSE file.
4
4
  #
5
- from ..plot.plot import ggplot
5
+ from ._plot2d_common import _get_bin_params_2d, _get_geom2d_layer, _get_marginal_layers
6
6
  from ..plot.core import DummySpec, aes
7
7
  from ..plot.geom import geom_smooth
8
8
  from ..plot.label import xlab, ylab
9
- from ._plot2d_common import _get_bin_params_2d, _get_geom2d_layer, _get_marginal_layers
9
+ from ..plot.plot import ggplot
10
10
 
11
11
  __all__ = ['joint_plot']
12
12
 
@@ -27,7 +27,7 @@ def _get_marginal_def(geom_kind, color_by=None):
27
27
  def _is_reg_line_needed(reg_line, geom_kind):
28
28
  if reg_line is not None:
29
29
  return reg_line
30
- if geom_kind == 'point':
30
+ if geom_kind in ['point', 'pointdensity']:
31
31
  return True
32
32
  else:
33
33
  return False
@@ -51,7 +51,7 @@ 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', 'hex', 'density2d', 'density2df'}, default='point'
54
+ geom : {'point', 'tile', 'hex', 'density2d', 'density2df', 'pointdensity'}, 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``.
@@ -165,7 +165,7 @@ 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', 'hex', 'density2d', 'density2df', 'none'}, default='point'
168
+ geom : {'point', 'tile', 'hex', 'density2d', 'density2df', 'pointdensity', '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``.
@@ -22,7 +22,7 @@ def ggsave(plot: Union[PlotSpec, SupPlotsSpec, GGBunch], filename: str, *, path:
22
22
  Export plot to a file.
23
23
  Supported formats: PNG, SVG, PDF, HTML.
24
24
 
25
- The exported file is created in directory ${user.dir}/lets-plot-images
25
+ The exported file is created in the directory ${user.dir}/lets-plot-images
26
26
  if not specified otherwise (see the ``path`` parameter).
27
27
 
28
28
  Parameters
@@ -36,7 +36,7 @@ def ggsave(plot: Union[PlotSpec, SupPlotsSpec, GGBunch], filename: str, *, path:
36
36
  Path to a directory to save image files in.
37
37
  By default, it is ${user.dir}/lets-plot-images.
38
38
  iframe : bool, default=True
39
- Whether to wrap HTML page into a iFrame.
39
+ Whether to wrap the HTML page into an iFrame.
40
40
  Only applicable when exporting to HTML.
41
41
  Some browsers may not display some UTF-8 characters correctly when setting iframe=True
42
42
  scale : float, default=2.0
@@ -44,19 +44,19 @@ def ggsave(plot: Union[PlotSpec, SupPlotsSpec, GGBunch], filename: str, *, path:
44
44
  Only applicable when exporting to PNG or PDF.
45
45
  w : float, default=None
46
46
  Width of the output image in units.
47
- Only applicable when exporting to SVG, PNG or PDF.
47
+ Only applicable when exporting to SVG, PNG, or PDF.
48
48
  h : float, default=None
49
49
  Height of the output image in units.
50
- Only applicable when exporting to SVG, PNG or PDF.
50
+ Only applicable when exporting to SVG, PNG, or PDF.
51
51
  unit : {'in', 'cm', 'mm', 'px'}, default='in'
52
52
  Unit of the output image. One of: 'in', 'cm', 'mm' or 'px'.
53
- Only applicable when exporting to SVG, PNG or PDF.
53
+ Only applicable when exporting to SVG, PNG, or PDF.
54
54
  dpi : int, default=300
55
55
  Resolution in dots per inch.
56
56
  Only applicable when exporting to PNG or PDF.
57
57
  The default value depends on the unit:
58
58
 
59
- - for 'px' it is 96 (output image will have the same pixel size as ``w`` and ``h`` values)
59
+ - for 'px' it is 96 (output image will have the same pixel size as ``w``, and ``h`` values)
60
60
  - for physical units ('in', 'cm', 'mm') it is 300.
61
61
 
62
62
  Returns
@@ -66,14 +66,21 @@ def ggsave(plot: Union[PlotSpec, SupPlotsSpec, GGBunch], filename: str, *, path:
66
66
 
67
67
  Notes
68
68
  -----
69
- Output format is inferred from the filename extension.
69
+ Large plot dimensions without units require explicit unit specification.
70
+ When ``w`` or ``h`` value exceeds 20 without specifying units (e.g., ``ggsave(p, 300, 400)``),
71
+ we ask to specify units explicitly:
72
+ ``ggsave(p, 300, 400, unit='px')`` or ``ggsave(p, 3, 4, unit='in')``.
70
73
 
71
- For PNG and PDF formats:
74
+ ----
75
+
76
+ The output format is inferred from the filename extension.
77
+
78
+ For PNG, and PDF formats:
72
79
 
73
80
  - If ``w``, ``h``, ``unit``, and ``dpi`` are all specified:
74
81
 
75
82
  - The plot's pixel size (default or set by `ggsize() <https://lets-plot.org/python/pages/api/lets_plot.ggsize.html>`__) is ignored.
76
- - The output size is calculated using the specified ``w``, ``h``, ``unit``, and ``dpi``.
83
+ - The output size is calculated using the specified ``w``, ``h``, ``unit`` and ``dpi``.
77
84
 
78
85
  - The plot is resized to fit the specified ``w`` x ``h`` area, which may affect the layout, tick labels, and other elements.
79
86
 
@@ -94,33 +101,43 @@ def ggsave(plot: Union[PlotSpec, SupPlotsSpec, GGBunch], filename: str, *, path:
94
101
 
95
102
  For SVG format:
96
103
 
97
- - If ``w``, ``h`` and ``unit`` are specified:
104
+ - If ``w``, ``h``, and ``unit`` are specified:
98
105
 
99
106
  - The plot's pixel size (default or set by `ggsize() <https://lets-plot.org/python/pages/api/lets_plot.ggsize.html>`__) is ignored.
100
107
  - The output size is calculated using the specified ``w``, ``h``, and ``unit``.
101
108
 
109
+ ----
110
+
111
+ Plots with ``geom_livemap()`` can be saved to HTML only.
112
+
102
113
 
103
114
  Examples
104
115
  --------
105
- .. code-block::
116
+ .. jupyter-execute::
106
117
  :linenos:
107
- :emphasize-lines: 4
118
+ :emphasize-lines: 6
108
119
 
120
+ from IPython.display import Image
109
121
  from lets_plot import *
110
122
  LetsPlot.setup_html()
111
- plot = ggplot() + geom_point(x=0, y=0)
112
- ggsave(plot, 'plot.html', path='.', iframe=False)
123
+ filename = 'plot.png'
124
+ plot = ggplot() + geom_point(x=0, y=0) + ggtitle(filename)
125
+ fullpath = ggsave(plot, filename, w=4, h=3)
126
+ Image(filename=fullpath, width=600, height=450)
113
127
 
114
128
  |
115
129
 
116
- .. code-block::
130
+ .. jupyter-execute::
117
131
  :linenos:
118
- :emphasize-lines: 4
132
+ :emphasize-lines: 6
119
133
 
134
+ from IPython.display import HTML
120
135
  from lets_plot import *
121
136
  LetsPlot.setup_html()
122
- plot = ggplot() + geom_point(x=0, y=0)
123
- ggsave(plot, 'plot.png', w=4, h=3)
137
+ filename = 'plot.html'
138
+ plot = ggplot() + geom_point(x=0, y=0) + ggtitle(filename)
139
+ fullpath = ggsave(plot, filename, iframe=False)
140
+ HTML(filename=fullpath)
124
141
 
125
142
  """
126
143