lets-plot 4.7.0rc1__cp39-cp39-manylinux2014_aarch64.manylinux_2_17_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 (95) hide show
  1. lets_plot/__init__.py +283 -0
  2. lets_plot/_global_settings.py +196 -0
  3. lets_plot/_kbridge.py +141 -0
  4. lets_plot/_type_utils.py +133 -0
  5. lets_plot/_version.py +6 -0
  6. lets_plot/bistro/__init__.py +16 -0
  7. lets_plot/bistro/_plot2d_common.py +100 -0
  8. lets_plot/bistro/corr.py +447 -0
  9. lets_plot/bistro/im.py +196 -0
  10. lets_plot/bistro/joint.py +192 -0
  11. lets_plot/bistro/qq.py +207 -0
  12. lets_plot/bistro/residual.py +341 -0
  13. lets_plot/bistro/waterfall.py +333 -0
  14. lets_plot/export/__init__.py +6 -0
  15. lets_plot/export/ggsave_.py +141 -0
  16. lets_plot/frontend_context/__init__.py +8 -0
  17. lets_plot/frontend_context/_configuration.py +151 -0
  18. lets_plot/frontend_context/_frontend_ctx.py +16 -0
  19. lets_plot/frontend_context/_html_contexts.py +117 -0
  20. lets_plot/frontend_context/_intellij_python_json_ctx.py +38 -0
  21. lets_plot/frontend_context/_json_contexts.py +39 -0
  22. lets_plot/frontend_context/_jupyter_notebook_ctx.py +119 -0
  23. lets_plot/frontend_context/_mime_types.py +7 -0
  24. lets_plot/frontend_context/_static_html_page_ctx.py +27 -0
  25. lets_plot/frontend_context/_static_svg_ctx.py +26 -0
  26. lets_plot/frontend_context/_webbr_html_page_ctx.py +29 -0
  27. lets_plot/frontend_context/sandbox.py +5 -0
  28. lets_plot/geo_data/__init__.py +19 -0
  29. lets_plot/geo_data/core.py +331 -0
  30. lets_plot/geo_data/geocoder.py +977 -0
  31. lets_plot/geo_data/geocodes.py +512 -0
  32. lets_plot/geo_data/gis/__init__.py +0 -0
  33. lets_plot/geo_data/gis/fluent_dict.py +201 -0
  34. lets_plot/geo_data/gis/geocoding_service.py +42 -0
  35. lets_plot/geo_data/gis/geometry.py +91 -0
  36. lets_plot/geo_data/gis/json_request.py +232 -0
  37. lets_plot/geo_data/gis/json_response.py +308 -0
  38. lets_plot/geo_data/gis/request.py +492 -0
  39. lets_plot/geo_data/gis/response.py +247 -0
  40. lets_plot/geo_data/livemap_helper.py +65 -0
  41. lets_plot/geo_data/to_geo_data_frame.py +141 -0
  42. lets_plot/geo_data/type_assertion.py +34 -0
  43. lets_plot/geo_data_internals/__init__.py +4 -0
  44. lets_plot/geo_data_internals/constants.py +13 -0
  45. lets_plot/geo_data_internals/utils.py +33 -0
  46. lets_plot/mapping.py +115 -0
  47. lets_plot/package_data/lets-plot.min.js +3 -0
  48. lets_plot/plot/__init__.py +64 -0
  49. lets_plot/plot/_global_theme.py +14 -0
  50. lets_plot/plot/annotation.py +290 -0
  51. lets_plot/plot/coord.py +242 -0
  52. lets_plot/plot/core.py +1060 -0
  53. lets_plot/plot/expand_limits_.py +78 -0
  54. lets_plot/plot/facet.py +206 -0
  55. lets_plot/plot/font_features.py +71 -0
  56. lets_plot/plot/geom.py +8839 -0
  57. lets_plot/plot/geom_extras.py +53 -0
  58. lets_plot/plot/geom_function_.py +216 -0
  59. lets_plot/plot/geom_imshow_.py +392 -0
  60. lets_plot/plot/geom_livemap_.py +310 -0
  61. lets_plot/plot/ggbunch_.py +96 -0
  62. lets_plot/plot/gggrid_.py +126 -0
  63. lets_plot/plot/ggtb_.py +55 -0
  64. lets_plot/plot/guide.py +229 -0
  65. lets_plot/plot/label.py +187 -0
  66. lets_plot/plot/marginal_layer.py +181 -0
  67. lets_plot/plot/plot.py +244 -0
  68. lets_plot/plot/pos.py +320 -0
  69. lets_plot/plot/sampling.py +338 -0
  70. lets_plot/plot/sandbox_.py +26 -0
  71. lets_plot/plot/scale.py +3577 -0
  72. lets_plot/plot/scale_colormap_mpl.py +297 -0
  73. lets_plot/plot/scale_convenience.py +155 -0
  74. lets_plot/plot/scale_identity_.py +658 -0
  75. lets_plot/plot/scale_position.py +1342 -0
  76. lets_plot/plot/series_meta.py +203 -0
  77. lets_plot/plot/stat.py +581 -0
  78. lets_plot/plot/subplots.py +322 -0
  79. lets_plot/plot/subplots_util.py +24 -0
  80. lets_plot/plot/theme_.py +772 -0
  81. lets_plot/plot/theme_set.py +393 -0
  82. lets_plot/plot/tooltip.py +486 -0
  83. lets_plot/plot/util.py +237 -0
  84. lets_plot/settings_utils.py +244 -0
  85. lets_plot/tilesets.py +429 -0
  86. lets_plot-4.7.0rc1.dist-info/METADATA +196 -0
  87. lets_plot-4.7.0rc1.dist-info/RECORD +95 -0
  88. lets_plot-4.7.0rc1.dist-info/WHEEL +6 -0
  89. lets_plot-4.7.0rc1.dist-info/licenses/LICENSE +21 -0
  90. lets_plot-4.7.0rc1.dist-info/licenses/licenses/LICENSE.FreeType +166 -0
  91. lets_plot-4.7.0rc1.dist-info/licenses/licenses/LICENSE.ImageMagick +106 -0
  92. lets_plot-4.7.0rc1.dist-info/licenses/licenses/LICENSE.expat +21 -0
  93. lets_plot-4.7.0rc1.dist-info/licenses/licenses/LICENSE.fontconfig +200 -0
  94. lets_plot-4.7.0rc1.dist-info/top_level.txt +2 -0
  95. lets_plot_kotlin_bridge.cpython-39-aarch64-linux-gnu.so +0 -0
@@ -0,0 +1,658 @@
1
+ #
2
+ # Copyright (c) 2019. JetBrains s.r.o.
3
+ # Use of this source code is governed by the MIT license that can be found in the LICENSE file.
4
+ #
5
+ from .scale import _scale
6
+
7
+ #
8
+ # Identity Scales
9
+ #
10
+
11
+ __all__ = ['scale_identity',
12
+ 'scale_color_identity',
13
+ 'scale_fill_identity',
14
+ 'scale_shape_identity',
15
+ 'scale_linetype_identity',
16
+ 'scale_alpha_identity',
17
+ 'scale_size_identity',
18
+ 'scale_linewidth_identity',
19
+ 'scale_stroke_identity'
20
+ ]
21
+
22
+
23
+ def scale_identity(aesthetic, *,
24
+ name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None, **other):
25
+ """
26
+ Use this scale when your data has already been scaled.
27
+ I.e. it already represents aesthetic values that the library can handle directly.
28
+ This will not produce a legend unless you also supply the breaks and labels.
29
+
30
+ Parameters
31
+ ----------
32
+ aesthetic : str or list
33
+ The name(s) of the aesthetic(s) that this scale works with.
34
+ name : str
35
+ The name of the scale - used as the axis label or the legend title.
36
+ breaks : list or dict
37
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
38
+ labels : list of str or dict
39
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
40
+ lablim : int, default=None
41
+ The maximum label length (in characters) before trimming is applied.
42
+ limits : list
43
+ Continuous scale: a numeric vector of length two providing limits of the scale.
44
+ Discrete scale: a vector specifying the data range for the scale
45
+ and the default order of their display in guides.
46
+ na_value
47
+ Missing values will be replaced with this value.
48
+ guide, default='none'
49
+ Guide to use for this scale.
50
+ format : str
51
+ Define the format for labels on the scale. The syntax resembles Python's:
52
+
53
+ - '.2f' -> '12.45'
54
+ - 'Num {}' -> 'Num 12.456789'
55
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
56
+
57
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
58
+
59
+ Returns
60
+ -------
61
+ `FeatureSpec` or `FeatureSpecArray`
62
+ Scales specification.
63
+
64
+ Examples
65
+ --------
66
+ .. jupyter-execute::
67
+ :linenos:
68
+ :emphasize-lines: 10
69
+
70
+ import numpy as np
71
+ from lets_plot import *
72
+ LetsPlot.setup_html()
73
+ n = 50
74
+ np.random.seed(42)
75
+ c = np.random.choice(['#e41a1c', '#377eb8', '#4daf4a'], size=n)
76
+ v = np.random.normal(size=n)
77
+ ggplot({'c': c, 'v': v}, aes(x='c', y='v')) + \\
78
+ geom_boxplot(aes(color='c', fill='c'), size=2) + \\
79
+ scale_identity(aesthetic=['color', 'fill'])
80
+
81
+ """
82
+ return _scale(aesthetic,
83
+ name=name,
84
+ breaks=breaks,
85
+ labels=labels,
86
+ lablim=lablim,
87
+ limits=limits,
88
+ expand=None,
89
+ na_value=na_value,
90
+ guide=guide,
91
+ trans=None,
92
+ format=format,
93
+ #
94
+ scale_mapper_kind='identity',
95
+ **other)
96
+
97
+
98
+ def scale_color_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
99
+ """
100
+ Use this scale when your data has already been scaled.
101
+ I.e. it already represents aesthetic values that the library can handle directly.
102
+ This will not produce a legend unless you also supply the breaks and labels.
103
+
104
+ Parameters
105
+ ----------
106
+ name : str
107
+ The name of the scale - used as the axis label or the legend title.
108
+ breaks : list or dict
109
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
110
+ labels : list of str or dict
111
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
112
+ lablim : int, default=None
113
+ The maximum label length (in characters) before trimming is applied.
114
+ limits : list
115
+ Continuous scale: a numeric vector of length two providing limits of the scale.
116
+ Discrete scale: a vector specifying the data range for the scale
117
+ and the default order of their display in guides.
118
+ guide, default='none'
119
+ Guide to use for this scale.
120
+ format : str
121
+ Define the format for labels on the scale. The syntax resembles Python's:
122
+
123
+ - '.2f' -> '12.45'
124
+ - 'Num {}' -> 'Num 12.456789'
125
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
126
+
127
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
128
+
129
+ Returns
130
+ -------
131
+ `FeatureSpec`
132
+ Scale specification.
133
+
134
+ Notes
135
+ -----
136
+ For more info about input data format, see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
137
+
138
+ Examples
139
+ --------
140
+ .. jupyter-execute::
141
+ :linenos:
142
+ :emphasize-lines: 10
143
+
144
+ import numpy as np
145
+ from lets_plot import *
146
+ LetsPlot.setup_html()
147
+ n = 50
148
+ np.random.seed(42)
149
+ c = np.random.choice(['#e41a1c', '#377eb8', '#4daf4a'], size=n)
150
+ v = np.random.normal(size=n)
151
+ ggplot({'c': c, 'v': v}, aes(x='c', y='v')) + \\
152
+ geom_boxplot(aes(color='c'), size=2) + \\
153
+ scale_color_identity()
154
+
155
+ """
156
+ return scale_identity('color',
157
+ name=name,
158
+ breaks=breaks,
159
+ labels=labels,
160
+ lablim=lablim,
161
+ limits=limits,
162
+ na_value=na_value,
163
+ guide=guide,
164
+ format=format)
165
+
166
+
167
+ def scale_fill_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
168
+ """
169
+ Use this scale when your data has already been scaled.
170
+ I.e. it already represents aesthetic values that the library can handle directly.
171
+ This will not produce a legend unless you also supply the breaks and labels.
172
+
173
+ Parameters
174
+ ----------
175
+ name : str
176
+ The name of the scale - used as the axis label or the legend title.
177
+ breaks : list or dict
178
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
179
+ labels : list of str or dict
180
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
181
+ lablim : int, default=None
182
+ The maximum label length (in characters) before trimming is applied.
183
+ limits : list
184
+ Continuous scale: a numeric vector of length two providing limits of the scale.
185
+ Discrete scale: a vector specifying the data range for the scale
186
+ and the default order of their display in guides.
187
+ guide, default='none'
188
+ Guide to use for this scale.
189
+ format : str
190
+ Define the format for labels on the scale. The syntax resembles Python's:
191
+
192
+ - '.2f' -> '12.45'
193
+ - 'Num {}' -> 'Num 12.456789'
194
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
195
+
196
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
197
+
198
+ Returns
199
+ -------
200
+ `FeatureSpec`
201
+ Scale specification.
202
+
203
+ Notes
204
+ -----
205
+ For more info about input data format, see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
206
+
207
+ Examples
208
+ --------
209
+ .. jupyter-execute::
210
+ :linenos:
211
+ :emphasize-lines: 8-10
212
+
213
+ import numpy as np
214
+ from lets_plot import *
215
+ LetsPlot.setup_html()
216
+ np.random.seed(42)
217
+ colors = {'red': '#e41a1c', 'green': '#4daf4a', 'blue': '#377eb8'}
218
+ c = np.random.choice(list(colors.values()), size=20)
219
+ ggplot({'c': c}, aes(x='c')) + geom_bar(aes(fill='c')) + \\
220
+ scale_fill_identity(guide=guide_legend(), name='color', \\
221
+ breaks=list(colors.values()), \\
222
+ labels=list(colors.keys()))
223
+
224
+ """
225
+ return scale_identity('fill',
226
+ name=name,
227
+ breaks=breaks,
228
+ labels=labels,
229
+ lablim=lablim,
230
+ limits=limits,
231
+ na_value=na_value,
232
+ guide=guide,
233
+ format=format)
234
+
235
+
236
+ def scale_shape_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
237
+ """
238
+ Use this scale when your data has already been scaled.
239
+ I.e. it already represents aesthetic values that the library can handle directly.
240
+ This will not produce a legend unless you also supply the breaks and labels.
241
+
242
+ Parameters
243
+ ----------
244
+ name : str
245
+ The name of the scale - used as the axis label or the legend title.
246
+ breaks : list or dict
247
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
248
+ labels : list of str or dict
249
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
250
+ lablim : int, default=None
251
+ The maximum label length (in characters) before trimming is applied.
252
+ limits : list
253
+ Continuous scale: a numeric vector of length two providing limits of the scale.
254
+ Discrete scale: a vector specifying the data range for the scale
255
+ and the default order of their display in guides.
256
+ guide, default='none'
257
+ Guide to use for this scale.
258
+ format : str
259
+ Define the format for labels on the scale. The syntax resembles Python's:
260
+
261
+ - '.2f' -> '12.45'
262
+ - 'Num {}' -> 'Num 12.456789'
263
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
264
+
265
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
266
+
267
+ Returns
268
+ -------
269
+ `FeatureSpec`
270
+ Scale specification.
271
+
272
+ Notes
273
+ -----
274
+ Input data expected: numeric codes of shapes.
275
+
276
+ Examples
277
+ --------
278
+ .. jupyter-execute::
279
+ :linenos:
280
+ :emphasize-lines: 11
281
+
282
+ from lets_plot import *
283
+ LetsPlot.setup_html()
284
+ n, m = 26, 6
285
+ x = [i % m for i in range(n)]
286
+ y = [int(i / m) for i in range(n)]
287
+ s = list(range(n))
288
+ ggplot({'x': x, 'y': y, 's': s}, aes('x', 'y')) + \\
289
+ geom_point(aes(shape='s'), size=10, show_legend=False, \\
290
+ color='#2166ac', fill='#fddbc7', \\
291
+ tooltips=layer_tooltips().line('shape #@s')) + \\
292
+ scale_shape_identity()
293
+
294
+ """
295
+ return scale_identity('shape',
296
+ name=name,
297
+ breaks=breaks,
298
+ labels=labels,
299
+ lablim=lablim,
300
+ limits=limits,
301
+ na_value=na_value,
302
+ guide=guide,
303
+ format=format,
304
+ #
305
+ solid=None,
306
+ discrete=True)
307
+
308
+
309
+ def scale_linetype_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
310
+ """
311
+ Use this scale when your data has already been scaled.
312
+ I.e. it already represents aesthetic values that the library can handle directly.
313
+ This will not produce a legend unless you also supply the breaks and labels.
314
+
315
+ Parameters
316
+ ----------
317
+ name : str
318
+ The name of the scale - used as the axis label or the legend title.
319
+ breaks : list or dict
320
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
321
+ labels : list of str or dict
322
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
323
+ lablim : int, default=None
324
+ The maximum label length (in characters) before trimming is applied.
325
+ limits : list
326
+ Continuous scale: a numeric vector of length two providing limits of the scale.
327
+ Discrete scale: a vector specifying the data range for the scale
328
+ and the default order of their display in guides.
329
+ guide, default='none'
330
+ Guide to use for this scale.
331
+ format : str
332
+ Define the format for labels on the scale. The syntax resembles Python's:
333
+
334
+ - '.2f' -> '12.45'
335
+ - 'Num {}' -> 'Num 12.456789'
336
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
337
+
338
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
339
+
340
+ Returns
341
+ -------
342
+ `FeatureSpec`
343
+ Scale specification.
344
+
345
+ Notes
346
+ -----
347
+ Input data expected: numeric codes or names of line types (e.g. 'dotdash').
348
+ The codes are: 0 = 'blank', 1 = 'solid', 2 = 'dashed', 3 = 'dotted', 4 = 'dotdash',
349
+ 5 = 'longdash', 6 = 'twodash'.
350
+
351
+ Examples
352
+ --------
353
+ .. jupyter-execute::
354
+ :linenos:
355
+ :emphasize-lines: 13
356
+
357
+ from lets_plot import *
358
+ LetsPlot.setup_html()
359
+ n = 7
360
+ data = {
361
+ 'x': [0] * n,
362
+ 'xend': [1] * n,
363
+ 'y': list(range(n)),
364
+ 'yend': list(range(n)),
365
+ }
366
+ ggplot(data) + \\
367
+ geom_segment(aes(x='x', xend='xend', y='y', \\
368
+ yend='yend', linetype='y')) + \\
369
+ scale_linetype_identity()
370
+
371
+ """
372
+ return scale_identity('linetype',
373
+ name=name,
374
+ breaks=breaks,
375
+ labels=labels,
376
+ lablim=lablim,
377
+ limits=limits,
378
+ na_value=na_value,
379
+ guide=guide,
380
+ format=format,
381
+ #
382
+ discrete=True)
383
+
384
+
385
+ def scale_alpha_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
386
+ """
387
+ Use this scale when your data has already been scaled.
388
+ I.e. it already represents aesthetic values that the library can handle directly.
389
+ This will not produce a legend unless you also supply the breaks and labels.
390
+
391
+ Parameters
392
+ ----------
393
+ name : str
394
+ The name of the scale - used as the axis label or the legend title.
395
+ breaks : list or dict
396
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
397
+ labels : list of str or dict
398
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
399
+ lablim : int, default=None
400
+ The maximum label length (in characters) before trimming is applied.
401
+ limits : list
402
+ Continuous scale: a numeric vector of length two providing limits of the scale.
403
+ Discrete scale: a vector specifying the data range for the scale
404
+ and the default order of their display in guides.
405
+ guide, default='none'
406
+ Guide to use for this scale.
407
+ format : str
408
+ Define the format for labels on the scale. The syntax resembles Python's:
409
+
410
+ - '.2f' -> '12.45'
411
+ - 'Num {}' -> 'Num 12.456789'
412
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
413
+
414
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
415
+
416
+ Returns
417
+ -------
418
+ `FeatureSpec`
419
+ Scale specification.
420
+
421
+ Notes
422
+ -----
423
+ Input data expected: numeric values in range [0, 1].
424
+
425
+ Examples
426
+ --------
427
+ .. jupyter-execute::
428
+ :linenos:
429
+ :emphasize-lines: 11
430
+
431
+ import numpy as np
432
+ from lets_plot import *
433
+ LetsPlot.setup_html()
434
+ n = 100
435
+ np.random.seed(42)
436
+ x = np.random.normal(size=n)
437
+ y = np.random.normal(size=n)
438
+ a = np.random.uniform(0, .5, size=n)
439
+ ggplot({'x': x, 'y': y, 'a': a}, aes('x', 'y')) + \\
440
+ geom_point(aes(alpha='a'), shape=21, size=10) + \\
441
+ scale_alpha_identity(limits=[.2, .5], breaks=[.2, .3, .4, .5])
442
+
443
+ """
444
+ return scale_identity('alpha',
445
+ name=name,
446
+ breaks=breaks,
447
+ labels=labels,
448
+ lablim=lablim,
449
+ limits=limits,
450
+ na_value=na_value,
451
+ guide=guide,
452
+ format=format)
453
+
454
+
455
+ def scale_size_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
456
+ """
457
+ Use this scale when your data has already been scaled.
458
+ I.e. it already represents aesthetic values that the library can handle directly.
459
+ This will not produce a legend unless you also supply the breaks and labels.
460
+
461
+ Parameters
462
+ ----------
463
+ name : str
464
+ The name of the scale - used as the axis label or the legend title.
465
+ breaks : list or dict
466
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
467
+ labels : list of str or dict
468
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
469
+ lablim : int, default=None
470
+ The maximum label length (in characters) before trimming is applied.
471
+ limits : list
472
+ Continuous scale: a numeric vector of length two providing limits of the scale.
473
+ Discrete scale: a vector specifying the data range for the scale
474
+ and the default order of their display in guides.
475
+ guide, default='none'
476
+ Guide to use for this scale.
477
+ format : str
478
+ Define the format for labels on the scale. The syntax resembles Python's:
479
+
480
+ - '.2f' -> '12.45'
481
+ - 'Num {}' -> 'Num 12.456789'
482
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
483
+
484
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
485
+
486
+ Returns
487
+ -------
488
+ `FeatureSpec`
489
+ Scale specification.
490
+
491
+ Notes
492
+ -----
493
+ Input data expected: positive numeric values.
494
+
495
+ Examples
496
+ --------
497
+ .. jupyter-execute::
498
+ :linenos:
499
+ :emphasize-lines: 11
500
+
501
+ import numpy as np
502
+ from lets_plot import *
503
+ LetsPlot.setup_html()
504
+ n = 100
505
+ np.random.seed(42)
506
+ x = np.random.normal(size=n)
507
+ y = np.random.normal(size=n)
508
+ w = np.random.choice([8, 10, 12], size=n)
509
+ ggplot({'x': x, 'y': y, 'w': w}, aes('x', 'y')) + \\
510
+ geom_point(aes(size='w'), shape=21, alpha=.2) + \\
511
+ scale_size_identity()
512
+
513
+ """
514
+ return scale_identity('size',
515
+ name=name,
516
+ breaks=breaks,
517
+ labels=labels,
518
+ lablim=lablim,
519
+ limits=limits,
520
+ na_value=na_value,
521
+ guide=guide,
522
+ format=format)
523
+
524
+
525
+ def scale_linewidth_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
526
+ """
527
+ Use this scale when your data has already been scaled.
528
+ I.e. it already represents aesthetic values that can be handled directly.
529
+ This will not produce a legend unless you also supply the breaks and labels.
530
+
531
+ Parameters
532
+ ----------
533
+ name : str
534
+ The name of the scale - used as the axis label or the legend title.
535
+ breaks : list or dict
536
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
537
+ labels : list of str or dict
538
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
539
+ lablim : int, default=None
540
+ The maximum label length (in characters) before trimming is applied.
541
+ limits : list
542
+ Continuous scale: a numeric vector of length two providing limits of the scale.
543
+ Discrete scale: a vector specifying the data range for the scale
544
+ and the default order of their display in guides.
545
+ guide, default='none'
546
+ Guide to use for this scale.
547
+ format : str
548
+ Define the format for labels on the scale. The syntax resembles Python's:
549
+
550
+ - '.2f' -> '12.45'
551
+ - 'Num {}' -> 'Num 12.456789'
552
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
553
+
554
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
555
+
556
+ Returns
557
+ -------
558
+ `FeatureSpec`
559
+ Scale specification.
560
+
561
+ Notes
562
+ -----
563
+ Input data expected: positive numeric values.
564
+
565
+ Examples
566
+ --------
567
+ .. jupyter-execute::
568
+ :linenos:
569
+ :emphasize-lines: 9
570
+
571
+ from lets_plot import *
572
+ LetsPlot.setup_html()
573
+ data = {
574
+ 'x': [0, 1, 2],
575
+ 'y': [1, 2, 1],
576
+ 'w': [1, 3, 2],
577
+ }
578
+ ggplot(data, aes('x', 'y')) + geom_lollipop(aes(linewidth='w')) + \\
579
+ scale_linewidth_identity()
580
+
581
+ """
582
+ return scale_identity('linewidth',
583
+ name=name,
584
+ breaks=breaks,
585
+ labels=labels,
586
+ lablim=lablim,
587
+ limits=limits,
588
+ na_value=na_value,
589
+ guide=guide,
590
+ format=format)
591
+
592
+
593
+ def scale_stroke_identity(name=None, breaks=None, labels=None, lablim=None, limits=None, na_value=None, guide='none', format=None):
594
+ """
595
+ Use this scale when your data has already been scaled.
596
+ I.e. it already represents aesthetic values that can be handled directly.
597
+ This will not produce a legend unless you also supply the breaks and labels.
598
+
599
+ Parameters
600
+ ----------
601
+ name : str
602
+ The name of the scale - used as the axis label or the legend title.
603
+ breaks : list or dict
604
+ A list of data values specifying the positions of ticks, or a dictionary which maps the tick labels to the breaks values.
605
+ labels : list of str or dict
606
+ A list of labels on ticks, or a dictionary which maps the breaks values to the tick labels.
607
+ lablim : int, default=None
608
+ The maximum label length (in characters) before trimming is applied.
609
+ limits : list
610
+ Continuous scale: a numeric vector of length two providing limits of the scale.
611
+ Discrete scale: a vector specifying the data range for the scale
612
+ and the default order of their display in guides.
613
+ guide, default='none'
614
+ Guide to use for this scale.
615
+ format : str
616
+ Define the format for labels on the scale. The syntax resembles Python's:
617
+
618
+ - '.2f' -> '12.45'
619
+ - 'Num {}' -> 'Num 12.456789'
620
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
621
+
622
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
623
+
624
+ Returns
625
+ -------
626
+ `FeatureSpec`
627
+ Scale specification.
628
+
629
+ Notes
630
+ -----
631
+ Input data expected: positive numeric values.
632
+
633
+ Examples
634
+ --------
635
+ .. jupyter-execute::
636
+ :linenos:
637
+ :emphasize-lines: 9
638
+
639
+ from lets_plot import *
640
+ LetsPlot.setup_html()
641
+ data = {
642
+ 'x': [0, 1, 2],
643
+ 'y': [1, 2, 1],
644
+ 's': [1, 3, 2],
645
+ }
646
+ ggplot(data, aes('x', 'y')) + geom_lollipop(aes(stroke='s')) + \\
647
+ scale_stroke_identity()
648
+
649
+ """
650
+ return scale_identity('stroke',
651
+ name=name,
652
+ breaks=breaks,
653
+ labels=labels,
654
+ lablim=lablim,
655
+ limits=limits,
656
+ na_value=na_value,
657
+ guide=guide,
658
+ format=format)