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.

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