lets-plot 4.6.0rc1__cp310-cp310-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 (91) hide show
  1. lets_plot/__init__.py +283 -0
  2. lets_plot/_global_settings.py +191 -0
  3. lets_plot/_kbridge.py +134 -0
  4. lets_plot/_type_utils.py +110 -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 +252 -0
  14. lets_plot/export/__init__.py +6 -0
  15. lets_plot/export/ggsave_.py +133 -0
  16. lets_plot/frontend_context/__init__.py +8 -0
  17. lets_plot/frontend_context/_configuration.py +144 -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 +18 -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 +2 -0
  48. lets_plot/plot/__init__.py +64 -0
  49. lets_plot/plot/_global_theme.py +14 -0
  50. lets_plot/plot/annotation.py +233 -0
  51. lets_plot/plot/coord.py +242 -0
  52. lets_plot/plot/core.py +943 -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 +8160 -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 +401 -0
  60. lets_plot/plot/geom_livemap_.py +330 -0
  61. lets_plot/plot/ggbunch_.py +96 -0
  62. lets_plot/plot/gggrid_.py +126 -0
  63. lets_plot/plot/ggtb_.py +56 -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 +346 -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 +1336 -0
  76. lets_plot/plot/series_meta.py +129 -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 +766 -0
  81. lets_plot/plot/theme_set.py +393 -0
  82. lets_plot/plot/tooltip.py +486 -0
  83. lets_plot/plot/util.py +226 -0
  84. lets_plot/settings_utils.py +244 -0
  85. lets_plot/tilesets.py +364 -0
  86. lets_plot-4.6.0rc1.dist-info/LICENSE +21 -0
  87. lets_plot-4.6.0rc1.dist-info/METADATA +199 -0
  88. lets_plot-4.6.0rc1.dist-info/RECORD +91 -0
  89. lets_plot-4.6.0rc1.dist-info/WHEEL +5 -0
  90. lets_plot-4.6.0rc1.dist-info/top_level.txt +2 -0
  91. lets_plot_kotlin_bridge.cpython-310-darwin.so +0 -0
@@ -0,0 +1,766 @@
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 .core import FeatureSpec
6
+
7
+ __all__ = [
8
+ 'theme',
9
+ 'element_blank',
10
+ "element_line",
11
+ 'element_rect',
12
+ 'element_text',
13
+ 'element_markdown',
14
+ 'margin',
15
+ 'element_geom',
16
+ ]
17
+
18
+
19
+ def theme(*,
20
+ exponent_format=None,
21
+
22
+ line=None,
23
+ rect=None,
24
+ text=None,
25
+ title=None,
26
+ # ToDo: aspect.ratio
27
+ axis=None,
28
+ axis_ontop=None, axis_ontop_x=None, axis_ontop_y=None,
29
+ axis_title=None, axis_title_x=None, axis_title_y=None,
30
+ # ToDo: axis.title.x.top, axis.title.x.bottom
31
+ # ToDo: axis.title.y.left, axis.title.y.right
32
+ axis_text=None, axis_text_x=None, axis_text_y=None,
33
+ # ToDo: axis.text.x.top, axis.text.x.bottom
34
+ # ToDo: axis.text.x.left, axis.text.x.right
35
+ axis_ticks=None, axis_ticks_x=None, axis_ticks_y=None,
36
+ # ToDo: axis.ticks.x.top, axis.ticks.x.bottom
37
+ # ToDo: axis.ticks.x.left, axis.ticks.x.right
38
+ axis_ticks_length=None, axis_ticks_length_x=None, axis_ticks_length_y=None,
39
+ axis_line=None, axis_line_x=None, axis_line_y=None,
40
+ # ToDo: axis.line.x.top, axis.line.x.bottom
41
+ # ToDo: axis.line.x.left, axis.line.x.right
42
+
43
+ legend_background=None,
44
+ legend_text=None, legend_title=None,
45
+ legend_position=None, legend_justification=None, legend_direction=None,
46
+ legend_margin=None,
47
+ legend_spacing=None, legend_spacing_x=None,legend_spacing_y=None,
48
+ legend_key=None,
49
+ legend_key_size=None, legend_key_width=None, legend_key_height=None,
50
+ legend_key_spacing=None, legend_key_spacing_x=None, legend_key_spacing_y=None,
51
+ legend_box=None, legend_box_just=None, legend_box_spacing=None,
52
+ legend_ticks=None, legend_ticks_length=None,
53
+
54
+ panel_background=None,
55
+ panel_border=None,
56
+ panel_border_ontop=None,
57
+
58
+ panel_grid=None,
59
+ panel_grid_ontop=None,
60
+ panel_grid_ontop_x=None,
61
+ panel_grid_ontop_y=None,
62
+ panel_grid_major=None,
63
+ panel_grid_minor=None,
64
+ panel_grid_major_x=None,
65
+ panel_grid_minor_x=None,
66
+ panel_grid_major_y=None,
67
+ panel_grid_minor_y=None,
68
+ panel_inset=None,
69
+
70
+ plot_background=None,
71
+ plot_title=None,
72
+ plot_subtitle=None,
73
+ plot_caption=None,
74
+ plot_message=None,
75
+ plot_margin=None,
76
+ plot_inset=None,
77
+
78
+ plot_title_position=None,
79
+ plot_caption_position=None,
80
+
81
+ strip_background=None, strip_background_x=None, strip_background_y=None,
82
+ strip_text=None, strip_text_x=None, strip_text_y=None,
83
+ # ToDo: strip.placement
84
+
85
+ axis_tooltip=None, axis_tooltip_x=None, axis_tooltip_y=None,
86
+ axis_tooltip_text=None, axis_tooltip_text_x=None, axis_tooltip_text_y=None,
87
+
88
+ tooltip=None,
89
+ tooltip_text=None, tooltip_title_text=None,
90
+
91
+ label_text=None,
92
+
93
+ geom=None
94
+ ):
95
+ """
96
+ Use `theme()` to modify individual components of a theme,
97
+ allowing you to control all non-data components of the plot.
98
+
99
+ Parameters
100
+ ----------
101
+ exponent_format : {'e', 'pow', 'pow_full'} or tuple, default='e'
102
+ Controls the appearance of numbers formatted with 'e' or 'g' types.
103
+
104
+ Value is either a string - style, or a tuple: (style, lower_exp_bound, upper_exp_bound)
105
+ where style can be:
106
+
107
+ - 'e' : e-notation (e.g., 1e+6)
108
+ - 'pow' : superscript powers of 10 in shortened form (e.g., 10^6)
109
+ - 'pow_full' : superscript powers of 10 with coefficient (e.g., 1×10^6)
110
+
111
+ For 'g' type formatting, scientific notation is applied when the number's exponent
112
+ is less than or equal to the lower_exp_bound (-7 by default) or greater than or equal
113
+ to the upper_exp_bound (6 by default, but can be affected by `precision` in format specifier).
114
+
115
+ See `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
116
+
117
+ Superscript is not supported when exporting to PNG/PDF.
118
+ line : str or dict
119
+ All line elements.
120
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
121
+ Set `element_line()` to specify line parameters.
122
+ rect : str or dict
123
+ All rectangular elements.
124
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
125
+ Set `element_rect()` to specify rectangular element parameters.
126
+ text : str or dict
127
+ All text elements.
128
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
129
+ Set `element_text()` to specify text parameters.
130
+ title : str or dict
131
+ All title elements: plot, axes, legends.
132
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
133
+ Set `element_text()` to specify title text parameters, inherited from `text`.
134
+ axis : str or dict
135
+ All axis elements: lines, ticks, texts, titles.
136
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
137
+ Set `element_line()` to specify axes parameters.
138
+ axis_ontop, axis_ontop_x, axis_ontop_y : bool, default=True
139
+ Option to place axis (lines, tickmarks and labels) over the data layers.
140
+ axis_title, axis_title_x, axis_title_y : str or dict
141
+ Labels of axes.
142
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
143
+ Set `element_text()` to specify axes label parameters.
144
+ `axis_title_*` inherits from `axis_title` which inherits from `text`.
145
+ axis_text, axis_text_x, axis_text_y : str or dict
146
+ Tick labels along axes.
147
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
148
+ Set `element_text()` to specify all axes tick label parameters.
149
+ `axis_text_*` inherits from `axis_text` which inherits from `text`.
150
+ axis_ticks, axis_ticks_x, axis_ticks_y : str or dict
151
+ Tick marks along axes.
152
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
153
+ Set `element_line()` to specify all tick mark parameters.
154
+ `axis_ticks_*` inherits from `axis_ticks` which inherits from `line`.
155
+ axis_ticks_length, axis_ticks_length_x, axis_ticks_length_y : float
156
+ Length of tick marks in px.
157
+ axis_line, axis_line_x, axis_line_y : str or dict
158
+ Lines along axes.
159
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
160
+ Set `element_line()` to specify line parameters along all axes.
161
+ `axis_line_*` inherits from `axis_line` which inherits from `line`.
162
+ legend_background : str or dict
163
+ Background of legend.
164
+ Set 'blank' or result of `element_blank()` to draw nothing.
165
+ Set `element_rect()` to specify legend background parameters, inherited from `rect`.
166
+ legend_text : str or dict
167
+ Legend item labels.
168
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
169
+ Set `element_text()` to specify legend item label parameters, inherited from `text`.
170
+ legend_title : str or dict
171
+ Title of legend.
172
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
173
+ Set `element_text()` to specify legend title parameters, inherited from `title`.
174
+ legend_position : {'none', 'left', 'right', 'bottom', 'top'} or list
175
+ The position of legends. To remove the plot legend, use the 'none' value.
176
+ If parameter is a list, then it should be a two-element numeric vector,
177
+ specifying the position inside the plotting area,
178
+ each value of float type between 0 and 1.
179
+ legend_justification : str or list
180
+ Anchor point for positioning legend. If parameter is a list, then
181
+ it should be a two-element numeric vector. The pair [0, 0] corresponds to the
182
+ bottom left corner, the pair [1, 1] corresponds to the top right.
183
+ For string parameter the only possible value is 'center'.
184
+ legend_direction : {'horizontal', 'vertical'}
185
+ Layout of items in legends.
186
+ legend_margin : number or list of numbers
187
+ Margin around each legend.
188
+ The margin may be specified using a number or a list of numbers:
189
+
190
+ - a number or list of one number - the same margin it applied to all four sides;
191
+ - a list of two numbers - the first margin applies to the top and bottom, the second - to the left and right;
192
+ - a list of three numbers - the first margin applies to the top, the second - to the right and left, the third - to the bottom;
193
+ - a list of four numbers - the margins are applied to the top, right, bottom and left in that order.
194
+
195
+ It is acceptable to use None for any side; in this case, the default value for the legend margin side will be used.
196
+ legend_spacing : float
197
+ Spacing between legends.
198
+ legend_spacing_x : float
199
+ Spacing between legends in the horizontal direction, inherited from `legend_spacing`.
200
+ legend_spacing_y : float
201
+ Spacing between legends in the vertical direction, inherited from `legend_spacing`.
202
+ legend_key : str or dict
203
+ Background underneath legend keys.
204
+ Set 'blank' or result of `element_blank()` to draw nothing.
205
+ Set `element_rect()` to specify legend key background parameters, inherited from `rect`.
206
+ legend_key_size : float
207
+ Size of legend keys.
208
+ legend_key_width : float
209
+ Key background width, inherited from `legend_key_size`.
210
+ legend_key_height : float
211
+ Key background height, inherited from `legend_key_size`.
212
+ legend_key_spacing : float
213
+ Spacing between legend keys.
214
+ legend_key_spacing_x : float
215
+ Spacing between legend keys in the horizontal direction, inherited from `legend_key_spacing`.
216
+ legend_key_spacing_y : float
217
+ Spacing between legend keys in the vertical direction, inherited from `legend_key_spacing`.
218
+ legend_box : {'horizontal', 'vertical'}
219
+ Arrangement of multiple legends.
220
+ legend_box_just : {'left', 'right', 'bottom', 'top', 'center'}
221
+ Justification of each legend within the overall bounding box, when there are multiple legends.
222
+ legend_box_spacing : float
223
+ Spacing between plotting area and legend box.
224
+ legend_ticks : str or dict
225
+ Tick marks in colorbars.
226
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
227
+ Set `element_line()` to specify all tick mark parameters.
228
+ `legend_ticks_*` DOES NOT inherit from `line`.
229
+ By default, the colorbar tick marks are drawn with the same color as the colorbar background.
230
+ legend_ticks_length : float
231
+ Length of colorbar tick marks in px.
232
+ panel_background : str or dict
233
+ Background of plotting area.
234
+ Set 'blank' or result of `element_blank()` to draw nothing.
235
+ Set `element_rect()` to specify plotting area background parameters, inherited from `rect`.
236
+ panel_border : str or dict
237
+ Border around plotting area.
238
+ Set 'blank' or result of `element_blank()` to draw nothing.
239
+ Set `element_rect()` to specify border parameters, inherited from `rect`.
240
+ panel_border_ontop : bool, default=True
241
+ Option to place border around plotting area over the data layers.
242
+ panel_grid, panel_grid_major, panel_grid_minor, panel_grid_major_x, panel_grid_major_y, panel_grid_minor_x, panel_grid_minor_y : str or dict
243
+ Grid lines. Specify major grid lines or minor grid lines separately if needed.
244
+ Set 'blank' or result of `element_blank()` to draw nothing.
245
+ Set `element_line()` to specify grid line parameters.
246
+ `panel_grid_*_*` inherits from `panel_grid_*` which inherits from `panel_grid`,
247
+ which in turn inherits from `line`.
248
+ panel_inset : number or list of numbers
249
+ Inset for a panel. The inset behaves like a padding for `coord_polar(transofrm_bkgr=False)` otherwise it behaves like a margin around the panel.
250
+ The inset may be specified using a number or a list of numbers:
251
+
252
+ - a number or list of one number - the same inset it applied to all four sides;
253
+ - a list of two numbers - the first inset applies to the top and bottom, the second - to the left and right;
254
+ - a list of three numbers - the first inset applies to the top, the second - to the right and left, the third - to the bottom;
255
+ - a list of four numbers - the insets are applied to the top, right, bottom and left in that order.
256
+
257
+ It is acceptable to use None for any side; in this case, the default value for the plot inset side will be used.
258
+ panel_grid_ontop, panel_grid_ontop_x, panel_grid_ontop_y : bool, default=False
259
+ Option to place major grid lines and minor grid lines over the data layers.
260
+ plot_background : str or dict
261
+ Background of the entire plot.
262
+ Set 'blank' or result of `element_blank()` to draw nothing.
263
+ Set `element_rect()` to specify plot background parameters, inherited from `rect`.
264
+ plot_title : str or dict
265
+ Plot title.
266
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
267
+ Set `element_text()` to specify plot title parameters, inherited from `title`.
268
+ plot_subtitle : str or dict
269
+ Plot subtitle.
270
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
271
+ Set `element_text()` to specify plot subtitle parameters, inherited from `plot_title` or `title`.
272
+ plot_caption : str or dict
273
+ Plot caption.
274
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
275
+ Set `element_text()` to specify plot caption parameters, inherited from `title`.
276
+ plot_message : str or dict
277
+ Plot message (e.g. sampling messages).
278
+ Set 'blank' or result of `element_blank()` to show nothing.
279
+ Set `element_text()` to show sampling messages (`element_text()` options don't affect a message text).
280
+ plot_margin : number or list of numbers
281
+ Margin around entire plot.
282
+ The margin may be specified using a number or a list of numbers:
283
+
284
+ - a number or list of one number - the same margin it applied to all four sides;
285
+ - a list of two numbers - the first margin applies to the top and bottom, the second - to the left and right;
286
+ - a list of three numbers - the first margin applies to the top, the second - to the right and left, the third - to the bottom;
287
+ - a list of four numbers - the margins are applied to the top, right, bottom and left in that order.
288
+
289
+ It is acceptable to use None for any side; in this case, the default value for the plot margin side will be used.
290
+ plot_inset : number or list of numbers
291
+ Inset for a plotting area, including the axes with their labels, but without titles.
292
+ The inset may be specified using a number or a list of numbers:
293
+
294
+ - a number or list of one number - the same inset it applied to all four sides;
295
+ - a list of two numbers - the first inset applies to the top and bottom, the second - to the left and right;
296
+ - a list of three numbers - the first inset applies to the top, the second - to the right and left, the third - to the bottom;
297
+ - a list of four numbers - the insets are applied to the top, right, bottom and left in that order.
298
+
299
+ It is acceptable to use None for any side; in this case, the default value for the plot inset side will be used.
300
+ plot_title_position : {'panel', 'plot'}, default='panel'
301
+ Alignment of the plot title/subtitle.
302
+ A value of 'panel' means that title and subtitle are aligned to the plot panels.
303
+ A value of 'plot' means that title and subtitle are aligned to the entire plot (excluding margins).
304
+ plot_caption_position : {'panel', 'plot'}, default='panel'
305
+ Alignment of the plot caption.
306
+ A value of 'panel' means that caption is aligned to the plot panels.
307
+ A value of 'plot' means that caption is aligned to the entire plot (excluding margins).
308
+ strip_background : str or dict
309
+ Background of facet labels.
310
+ Set 'blank' or result of `element_blank()` to draw nothing.
311
+ Set `element_rect()` to specify facet label background parameters, inherited from `rect`.
312
+ strip_background_x : str or dict
313
+ Horizontal facet background.
314
+ Set 'blank' or result of `element_blank()` to draw nothing.
315
+ Set `element_rect()` to specify facet label background parameters, inherited from `strip_background`.
316
+ strip_background_y : str or dict
317
+ Vertical facet background.
318
+ Set 'blank' or result of `element_blank()` to draw nothing.
319
+ Set `element_rect()` to specify facet label background parameters, inherited from `strip_background`.
320
+ strip_text : str or dict
321
+ Facet labels.
322
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
323
+ Set `element_text()` to specify facet label parameters, inherited from `text`.
324
+ strip_text_x : str or dict
325
+ Horizontal facet labels.
326
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
327
+ Set `element_text()` to specify facet label parameters, inherited from `strip_text`.
328
+ strip_text_y : str or dict
329
+ Vertical facet labels.
330
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
331
+ Set `element_text()` to specify facet label parameters, inherited from `strip_text`.
332
+ axis_tooltip, axis_tooltip_x, axis_tooltip_y : str or dict
333
+ Axes tooltips.
334
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
335
+ Set `element_rect()` to specify axes tooltip parameters.
336
+ `axis_tooltip_*` inherits from `axis_tooltip` which inherits from `rect`.
337
+ axis_tooltip_text, axis_tooltip_text_x, axis_tooltip_text_y : str or dict
338
+ Text in axes tooltips.
339
+ Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
340
+ Set `element_text()` to specify axes text tooltip parameters.
341
+ `axis_tooltip_text_*` inherits from `axis_tooltip_text` which inherits from `tooltip_text`.
342
+ tooltip : str or dict
343
+ General tooltip.
344
+ Set 'blank' or result of `element_blank()` to hide the tooltip (also hides side tooltips).
345
+ Set `element_rect()` to specify tooltip rectangular parameters, inherited from `rect`.
346
+ tooltip_text : str or dict
347
+ Text in general tooltip.
348
+ Set `element_text()` to specify tooltip text parameters.
349
+ tooltip_title_text : str or dict
350
+ Tooltip title text.
351
+ Set `element_text()` to specify tooltip title parameters, inherited from `tooltip_text`. Bold by default.
352
+ label_text : str or dict
353
+ Annotation text.
354
+ Annotations are currently supported for pie and bar charts.
355
+ Set `element_text()` to specify annotation text parameters: font family and face, text size, text color.
356
+ geom : dict
357
+ Geometry colors.
358
+ Set `element_geom()` to specify new values for the named colors.
359
+
360
+ Returns
361
+ -------
362
+ `FeatureSpec`
363
+ Theme specification.
364
+
365
+ Examples
366
+ --------
367
+ .. jupyter-execute::
368
+ :linenos:
369
+ :emphasize-lines: 11-16
370
+
371
+ import numpy as np
372
+ from lets_plot import *
373
+ LetsPlot.setup_html()
374
+ n = 100
375
+ np.random.seed(42)
376
+ x = np.random.normal(size=n)
377
+ c = np.random.choice(['a', 'b', 'c'], size=n)
378
+ ggplot({'x': x, 'class': c}, aes('x')) + \\
379
+ geom_density(aes(color='class'), size=2) + \\
380
+ ggtitle('Density of classes') + \\
381
+ theme(axis_line=element_line(size=4), \\
382
+ axis_ticks_length=10, \\
383
+ axis_title_y='blank', \\
384
+ legend_position=[1, 1], legend_justification=[1, 1], \\
385
+ panel_background=element_rect(color='black', fill='#eeeeee', size=2), \\
386
+ panel_grid=element_line(color='black', size=1))
387
+
388
+ |
389
+
390
+ .. jupyter-execute::
391
+ :linenos:
392
+ :emphasize-lines: 14-19
393
+
394
+ import numpy as np
395
+ from lets_plot import *
396
+ LetsPlot.setup_html()
397
+ n = 1000
398
+ np.random.seed(42)
399
+ p = np.random.uniform(size=7)
400
+ x = np.random.choice(range(p.size), p=p/p.sum(), size=n)
401
+ c = np.random.choice(['a', 'b', 'c'], p=[.5, .3, .2], size=n)
402
+ ggplot({'x': x, 'class': c}) + \\
403
+ geom_bar(aes('x', fill='x')) + \\
404
+ scale_y_continuous(breaks=list(range(0, 151, 25))) + \\
405
+ scale_fill_discrete() + \\
406
+ facet_grid(y='class') + \\
407
+ theme(axis_line_x='blank', \\
408
+ axis_ticks=element_line(color='white'), \\
409
+ panel_grid_major_x='blank', \\
410
+ strip_background=element_rect(color='black', fill='white'), \\
411
+ axis_tooltip=element_rect(color='black', fill='white'), \\
412
+ legend_position='top')
413
+
414
+ """
415
+
416
+ filtered = _filter_none(locals())
417
+ return FeatureSpec('theme', name=None, **filtered)
418
+
419
+
420
+ def _filter_none(original: dict) -> dict:
421
+ def _filter_val(value):
422
+ if isinstance(value, dict):
423
+ return _filter_none(value)
424
+ else:
425
+ return value
426
+
427
+ return {k: _filter_val(v) for k, v in original.items() if v is not None}
428
+
429
+
430
+ def element_blank() -> dict:
431
+ """
432
+ Specify how non-data components of the plot are drawn.
433
+ This theme element draws nothing, and assigns no space.
434
+
435
+ Returns
436
+ -------
437
+ `dict`
438
+ Theme element specification.
439
+
440
+ Examples
441
+ --------
442
+ .. jupyter-execute::
443
+ :linenos:
444
+ :emphasize-lines: 7
445
+
446
+ import numpy as np
447
+ from lets_plot import *
448
+ LetsPlot.setup_html()
449
+ np.random.seed(42)
450
+ data = {'x': np.random.normal(size=1000)}
451
+ ggplot(data, aes(x='x')) + geom_histogram() + \\
452
+ theme(axis_title_x=element_blank(), axis_ticks=element_blank())
453
+
454
+ """
455
+ return dict(blank=True)
456
+
457
+
458
+ def element_rect(
459
+ fill=None,
460
+ color=None,
461
+ size=None,
462
+ linetype=None,
463
+ blank=False,
464
+ ) -> dict:
465
+ """
466
+ Specify how non-data components of the plot are drawn.
467
+ This theme element draws borders and backgrounds.
468
+
469
+ Parameters
470
+ ----------
471
+ fill : str
472
+ Fill color.
473
+ color : str
474
+ Border color.
475
+ size : int
476
+ Border size.
477
+ linetype : int or str or list
478
+ Type of the line. Accepts the following values:
479
+
480
+ - Codes or names: 0 = 'blank', 1 = 'solid', 2 = 'dashed', 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'.
481
+ - A string of an even number (up to eight) of hexadecimal digits, specifying the lengths in consecutive positions.
482
+ - A list defines the pattern of dashes and gaps, either with an offset: [offset, [dash, gap, ...]], or without an offset: [dash, gap, ...].
483
+
484
+ For more info see `Line Types <https://lets-plot.org/python/pages/aesthetics.html#line-types>`__.
485
+ blank : bool, default=False
486
+ If True - draws nothing, and assigns no space.
487
+
488
+ Returns
489
+ -------
490
+ `dict`
491
+ Theme element specification.
492
+
493
+ Examples
494
+ --------
495
+ .. jupyter-execute::
496
+ :linenos:
497
+ :emphasize-lines: 7
498
+
499
+ import numpy as np
500
+ from lets_plot import *
501
+ LetsPlot.setup_html()
502
+ np.random.seed(42)
503
+ data = {'x': np.random.normal(size=1000)}
504
+ ggplot(data, aes(x='x')) + geom_histogram() + \\
505
+ theme(panel_background=element_rect(fill='#f7fcf5'))
506
+
507
+ """
508
+ return locals()
509
+
510
+
511
+ def element_line(
512
+ color=None,
513
+ size=None,
514
+ linetype=None,
515
+ # ToDo: lineend, arrow
516
+ blank=False,
517
+ ) -> dict:
518
+ """
519
+ Specify how non-data components of the plot are drawn.
520
+ This theme element draws lines.
521
+
522
+ Parameters
523
+ ----------
524
+ color : str
525
+ Line color.
526
+ size : int
527
+ Line size.
528
+ linetype : int or str or list
529
+ Type of the line. Accepts the following values:
530
+
531
+ - Codes or names: 0 = 'blank', 1 = 'solid', 2 = 'dashed', 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'.
532
+ - A string of an even number (up to eight) of hexadecimal digits, specifying the lengths in consecutive positions.
533
+ - A list defines the pattern of dashes and gaps, either with an offset: [offset, [dash, gap, ...]], or without an offset: [dash, gap, ...].
534
+
535
+ For more info see `Line Types <https://lets-plot.org/python/pages/aesthetics.html#line-types>`__.
536
+ blank : bool, default=False
537
+ If True - draws nothing, and assigns no space.
538
+
539
+ Returns
540
+ -------
541
+ `dict`
542
+ Theme element specification.
543
+
544
+ Examples
545
+ --------
546
+ .. jupyter-execute::
547
+ :linenos:
548
+ :emphasize-lines: 7
549
+
550
+ import numpy as np
551
+ from lets_plot import *
552
+ LetsPlot.setup_html()
553
+ np.random.seed(42)
554
+ data = {'x': np.random.normal(size=1000)}
555
+ ggplot(data, aes(x='x')) + geom_histogram() + \\
556
+ theme(panel_grid=element_line(size=3, linetype='dashed'))
557
+
558
+ """
559
+ return locals()
560
+
561
+
562
+ def element_text(
563
+ color=None,
564
+ family=None,
565
+ face=None,
566
+ size=None,
567
+ angle=None,
568
+ # ToDo: lineheight
569
+ hjust=None,
570
+ vjust=None,
571
+ margin=None,
572
+ blank=False,
573
+ ) -> dict:
574
+ """
575
+ Specify how non-data components of the plot are drawn.
576
+ This theme element draws texts.
577
+
578
+ Parameters
579
+ ----------
580
+ color : str
581
+ Text color.
582
+ family : str
583
+ Font family.
584
+ face : str
585
+ Font face ("plain", "italic", "bold", "bold_italic").
586
+ size : int
587
+ Text size in px.
588
+ angle : float
589
+ Angle to rotate the text (in degrees).
590
+ hjust : float
591
+ Horizontal justification (in [0, 1]).
592
+ 0 - left-justified;
593
+ 1 - right-justified;
594
+ 0.5 - center-justified.
595
+ Can be used with values out of range, but behaviour is not specified.
596
+ vjust : float
597
+ Vertical justification (in [0, 1]).
598
+ 0 - bottom-justified;
599
+ 1 - top-justified;
600
+ 0.5 - middle-justified.
601
+ Can be used with values out of range, but behaviour is not specified.
602
+ margin : number or list of numbers
603
+ Margins around the text.
604
+
605
+ The margin may be specified using a number or a list of numbers:
606
+ - a number or list of one number - the same margin it applied to all four sides;
607
+ - a list of two numbers - the first margin applies to the top and bottom, the second - to the left and right;
608
+ - a list of three numbers - the first margin applies to the top, the second - to the right and left,
609
+ the third - to the bottom;
610
+ - a list of four numbers - the margins are applied to the top, right, bottom and left in that order.
611
+
612
+ It is acceptable to use None for any side; in this case, the default side value for this element will be used.
613
+ blank : bool, default=False
614
+ If True - draws nothing, and assigns no space.
615
+
616
+ Returns
617
+ -------
618
+ `dict`
619
+ Theme element specification.
620
+
621
+ Examples
622
+ --------
623
+ .. jupyter-execute::
624
+ :linenos:
625
+ :emphasize-lines: 7
626
+
627
+ import numpy as np
628
+ from lets_plot import *
629
+ LetsPlot.setup_html()
630
+ np.random.seed(42)
631
+ data = {'x': np.random.normal(size=1000)}
632
+ ggplot(data, aes(x='x')) + geom_histogram() + \\
633
+ theme(axis_text=element_text(color='#cb181d', face='bold_italic', margin=[5, 10]))
634
+
635
+ """
636
+ return locals()
637
+
638
+
639
+ def element_markdown(
640
+ color=None,
641
+ family=None,
642
+ face=None,
643
+ size=None,
644
+ angle=None,
645
+ # ToDo: lineheight
646
+ hjust=None,
647
+ vjust=None,
648
+ margin=None,
649
+ blank=False,
650
+ ) -> dict:
651
+ """
652
+ Specify how non-data components of the plot are drawn.
653
+ This theme element draws texts with Markdown support.
654
+
655
+ Parameters
656
+ ----------
657
+ color : str
658
+ Text color.
659
+ family : str
660
+ Font family.
661
+ face : str
662
+ Font face ("plain", "italic", "bold", "bold_italic").
663
+ size : int
664
+ Text size in px.
665
+ angle : float
666
+ Angle to rotate the text (in degrees).
667
+ hjust : float
668
+ Horizontal justification (in [0, 1]).
669
+ 0 - left-justified;
670
+ 1 - right-justified;
671
+ 0.5 - center-justified.
672
+ Can be used with values out of range, but behaviour is not specified.
673
+ vjust : float
674
+ Vertical justification (in [0, 1]).
675
+ 0 - bottom-justified;
676
+ 1 - top-justified;
677
+ 0.5 - middle-justified.
678
+ Can be used with values out of range, but behaviour is not specified.
679
+ margin : number or list of numbers
680
+ Margins around the text.
681
+
682
+ The margin may be specified using a number or a list of numbers:
683
+ - a number or list of one number - the same margin it applied to all four sides;
684
+ - a list of two numbers - the first margin applies to the top and bottom, the second - to the left and right;
685
+ - a list of three numbers - the first margin applies to the top, the second - to the right and left,
686
+ the third - to the bottom;
687
+ - a list of four numbers - the margins are applied to the top, right, bottom and left in that order.
688
+
689
+ It is acceptable to use None for any side; in this case, the default side value for this element will be used.
690
+ blank : bool, default=False
691
+ If True - draws nothing, and assigns no space.
692
+
693
+ Returns
694
+ -------
695
+ `dict`
696
+ Theme element specification.
697
+
698
+ Examples
699
+ --------
700
+ .. jupyter-execute::
701
+ :linenos:
702
+ :emphasize-lines: 7
703
+
704
+ import numpy as np
705
+ from lets_plot import *
706
+ LetsPlot.setup_html()
707
+ np.random.seed(42)
708
+ data = {'x': np.random.normal(size=1000)}
709
+ ggplot(data, aes(x='x')) + geom_histogram() + \\
710
+ theme(axis_text=element_text(color='#cb181d', face='bold_italic', margin=[5, 10]))
711
+
712
+ """
713
+ return {'markdown': True, **locals()}
714
+
715
+
716
+ def margin(t=None, r=None, b=None, l=None):
717
+ """
718
+ Function `margin()` is deprecated.
719
+ Please, use a number or list of numbers to specify margins (see description of the parameter used).
720
+
721
+ """
722
+ print("WARN: The margin() is deprecated and will be removed in future releases.\n"
723
+ " Please, use a number or list of numbers to specify margins (see description of the parameter used).")
724
+
725
+ return [t, r, b, l]
726
+
727
+
728
+ def element_geom(
729
+ pen=None,
730
+ brush=None,
731
+ paper=None,
732
+ # ToDo: fatten
733
+ ) -> dict:
734
+ """
735
+ Specify new values for the named colors.
736
+
737
+ Parameters
738
+ ----------
739
+ pen : str
740
+ Color to use by name "pen".
741
+ brush : str
742
+ Color to use by name "brush".
743
+ paper : str
744
+ Color to use by name "paper".
745
+
746
+ Returns
747
+ -------
748
+ `dict`
749
+ Theme element specification.
750
+
751
+ Examples
752
+ --------
753
+ .. jupyter-execute::
754
+ :linenos:
755
+ :emphasize-lines: 7
756
+
757
+ import numpy as np
758
+ from lets_plot import *
759
+ LetsPlot.setup_html()
760
+ np.random.seed(42)
761
+ data = {'x': np.random.normal(size=1000)}
762
+ ggplot(data, aes(x='x')) + geom_histogram(color='pen', fill='paper') + \\
763
+ theme(geom=element_geom(pen='dark_blue', paper='light_blue'))
764
+
765
+ """
766
+ return locals()