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