lets-plot 4.3.3__cp38-cp38-win_amd64.whl → 4.4.0__cp38-cp38-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.

@@ -13,6 +13,7 @@ from .geom_function_ import *
13
13
  from .geom_imshow_ import *
14
14
  from .geom_livemap_ import *
15
15
  from .gggrid_ import *
16
+ from .ggtb_ import *
16
17
  from .guide import *
17
18
  from .label import *
18
19
  from .marginal_layer import *
@@ -20,6 +21,7 @@ from .plot import *
20
21
  from .pos import *
21
22
  from .sampling import *
22
23
  from .scale import *
24
+ from .scale_colormap_mpl import *
23
25
  from .scale_convenience import *
24
26
  from .scale_identity_ import *
25
27
  from .scale_position import *
@@ -42,6 +44,7 @@ __all__ = (coord.__all__ +
42
44
  pos.__all__ +
43
45
  sampling.__all__ +
44
46
  scale.__all__ +
47
+ scale_colormap_mpl.__all__ +
45
48
  scale_convenience.__all__ +
46
49
  scale_identity_.__all__ +
47
50
  scale_position.__all__ +
@@ -52,5 +55,6 @@ __all__ = (coord.__all__ +
52
55
  annotation.__all__ +
53
56
  marginal_layer.__all__ +
54
57
  font_features.__all__ +
55
- gggrid_.__all__
58
+ gggrid_.__all__ +
59
+ ggtb_.__all__
56
60
  )
@@ -109,10 +109,9 @@ class layer_labels(FeatureSpec):
109
109
  --------
110
110
  .. jupyter-execute::
111
111
  :linenos:
112
- :emphasize-lines: 8
112
+ :emphasize-lines: 7
113
113
 
114
114
  from lets_plot import *
115
- from lets_plot.mapping import *
116
115
  LetsPlot.setup_html()
117
116
  data = {'name': ['a', 'b', 'c', 'd', 'b'], 'value': [40, 90, 10, 50, 20 ] }
118
117
  ggplot(data) + geom_pie(aes(fill=as_discrete('name', order_by='..count..'), weight='value'), \\
@@ -124,10 +123,9 @@ class layer_labels(FeatureSpec):
124
123
 
125
124
  .. jupyter-execute::
126
125
  :linenos:
127
- :emphasize-lines: 8, 10, 12, 14
126
+ :emphasize-lines: 7, 9, 11, 13
128
127
 
129
128
  from lets_plot import *
130
- from lets_plot.mapping import *
131
129
  LetsPlot.setup_html()
132
130
  data = {'name': ['a', 'b', 'c', 'd', 'b'], 'value': [40, 90, 10, 50, 20 ] }
133
131
  ggplot(data) + geom_pie(aes(fill=as_discrete('name', order_by='..count..', order=1), weight='value'), \\
lets_plot/plot/coord.py CHANGED
@@ -218,11 +218,10 @@ def coord_polar(xlim=None, ylim=None, theta=None, start=None, direction=None, tr
218
218
  --------
219
219
  .. jupyter-execute::
220
220
  :linenos:
221
- :emphasize-lines: 14
221
+ :emphasize-lines: 13
222
222
 
223
223
  import numpy as np
224
224
  from lets_plot import *
225
- from lets_plot.mapping import as_discrete
226
225
  LetsPlot.setup_html()
227
226
  np.random.seed(42)
228
227
  n = 20
lets_plot/plot/core.py CHANGED
@@ -162,7 +162,7 @@ class FeatureSpec():
162
162
 
163
163
  Do not use this class explicitly.
164
164
 
165
- Instead you should construct its objects with functions `ggplot()`, `geom_point()`,
165
+ Instead, you should construct its objects with functions `ggplot()`, `geom_point()`,
166
166
  `position_dodge()`, `scale_x_continuous()` etc.
167
167
  """
168
168
 
@@ -175,26 +175,6 @@ class FeatureSpec():
175
175
  self.__props.update(**kwargs)
176
176
 
177
177
  def props(self):
178
- """
179
- Return the dictionary of all properties of the object in their initial form.
180
-
181
- Returns
182
- -------
183
- dict
184
- Dictionary of properties.
185
-
186
- Examples
187
- --------
188
- .. jupyter-execute::
189
- :linenos:
190
- :emphasize-lines: 4
191
-
192
- from lets_plot import *
193
- LetsPlot.setup_html()
194
- p = ggplot({'x': [0], 'y': [0]}) + geom_point(aes('x', 'y'))
195
- p.props()
196
-
197
- """
198
178
  return self.__props
199
179
 
200
180
  def as_dict(self):
@@ -228,16 +208,16 @@ class FeatureSpec():
228
208
  # nothing
229
209
  return self
230
210
 
231
- """
232
- self + plot -> fail
233
- self + other_feature -> [self,other_feature]
234
- """
235
- if isinstance(other, PlotSpec):
236
- # pass and fail
211
+ if self.kind in ["plot", "subplots"]:
212
+ # pass and fail: don't allow to add plot to a feature list.
237
213
  pass
238
- if isinstance(other, FeatureSpec):
239
- arr = FeatureSpecArray(self, other)
240
- return arr
214
+ elif isinstance(other, FeatureSpec):
215
+ if other.kind in ["plot", "subplots"]:
216
+ # pass and fail: don't allow to add plot to a feature list.
217
+ pass
218
+ else:
219
+ arr = FeatureSpecArray(self, other)
220
+ return arr
241
221
 
242
222
  raise TypeError('unsupported operand type(s) for +: {} and {}'
243
223
  .format(self.__class__, other.__class__))
@@ -416,6 +396,11 @@ class PlotSpec(FeatureSpec):
416
396
  plot = plot.__add__(spec)
417
397
  return plot
418
398
 
399
+ if other.kind == 'guides':
400
+ existing_guides_options = plot.props().get('guides', {})
401
+ plot.props()['guides'] = _merge_dicts_recursively(existing_guides_options, other.as_dict())
402
+ return plot
403
+
419
404
  # add feature to properties
420
405
  plot.props()[other.kind] = other
421
406
  return plot
@@ -829,6 +814,16 @@ def _generate_data(size):
829
814
  return PlotSpec(data='x' * size, mapping=None, scales=[], layers=[])
830
815
 
831
816
 
817
+ def _merge_dicts_recursively(d1, d2):
818
+ merged = d1.copy()
819
+ for key, value in d2.items():
820
+ if isinstance(value, dict) and isinstance(merged.get(key), dict):
821
+ merged[key] = _merge_dicts_recursively(merged[key], value)
822
+ else:
823
+ merged[key] = value
824
+ return merged
825
+
826
+
832
827
  def _theme_dicts_merge(x, y):
833
828
  """
834
829
  Simple values in `y` override values in `x`.