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