lets-plot 4.6.2__cp310-cp310-win_amd64.whl → 4.7.0rc2__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lets-plot might be problematic. Click here for more details.
- lets_plot/_global_settings.py +5 -0
- lets_plot/_kbridge.py +7 -0
- lets_plot/_type_utils.py +29 -6
- lets_plot/_version.py +1 -1
- lets_plot/bistro/im.py +2 -2
- lets_plot/bistro/waterfall.py +93 -12
- lets_plot/export/ggsave_.py +22 -14
- lets_plot/package_data/lets-plot.min.js +2 -1
- lets_plot/plot/annotation.py +75 -18
- lets_plot/plot/core.py +147 -30
- lets_plot/plot/geom.py +730 -89
- lets_plot/plot/geom_function_.py +1 -1
- lets_plot/plot/geom_imshow_.py +42 -51
- lets_plot/plot/pos.py +13 -44
- lets_plot/plot/scale_position.py +9 -3
- lets_plot/plot/series_meta.py +179 -105
- lets_plot/plot/stat.py +4 -4
- lets_plot/plot/subplots.py +4 -4
- lets_plot/plot/theme_.py +57 -54
- lets_plot/plot/util.py +15 -4
- {lets_plot-4.6.2.dist-info → lets_plot-4.7.0rc2.dist-info}/METADATA +5 -3
- {lets_plot-4.6.2.dist-info → lets_plot-4.7.0rc2.dist-info}/RECORD +30 -26
- {lets_plot-4.6.2.dist-info → lets_plot-4.7.0rc2.dist-info}/WHEEL +1 -1
- lets_plot-4.7.0rc2.dist-info/licenses/licenses/LICENSE.FreeType +166 -0
- lets_plot-4.7.0rc2.dist-info/licenses/licenses/LICENSE.ImageMagick +106 -0
- lets_plot-4.7.0rc2.dist-info/licenses/licenses/LICENSE.expat +21 -0
- lets_plot-4.7.0rc2.dist-info/licenses/licenses/LICENSE.fontconfig +200 -0
- lets_plot_kotlin_bridge.cp310-win_amd64.pyd +0 -0
- {lets_plot-4.6.2.dist-info → lets_plot-4.7.0rc2.dist-info}/licenses/LICENSE +0 -0
- {lets_plot-4.6.2.dist-info → lets_plot-4.7.0rc2.dist-info}/top_level.txt +0 -0
lets_plot/plot/geom.py
CHANGED
|
@@ -19,14 +19,14 @@ __all__ = ['geom_point', 'geom_path', 'geom_line',
|
|
|
19
19
|
'geom_contourf', 'geom_polygon', 'geom_map',
|
|
20
20
|
'geom_abline', 'geom_hline', 'geom_vline',
|
|
21
21
|
'geom_band',
|
|
22
|
-
'geom_boxplot', 'geom_violin', 'geom_ydotplot',
|
|
22
|
+
'geom_boxplot', 'geom_violin', 'geom_sina', 'geom_ydotplot',
|
|
23
23
|
'geom_area_ridges',
|
|
24
24
|
'geom_ribbon', 'geom_area', 'geom_density',
|
|
25
25
|
'geom_density2d', 'geom_density2df', 'geom_jitter',
|
|
26
26
|
'geom_qq', 'geom_qq2', 'geom_qq_line', 'geom_qq2_line',
|
|
27
27
|
'geom_freqpoly', 'geom_step', 'geom_rect',
|
|
28
28
|
'geom_segment', 'geom_curve', 'geom_spoke',
|
|
29
|
-
'geom_text', 'geom_label', 'geom_pie', 'geom_lollipop',
|
|
29
|
+
'geom_text', 'geom_label', 'geom_text_repel', 'geom_label_repel', 'geom_pie', 'geom_lollipop',
|
|
30
30
|
'geom_count',
|
|
31
31
|
'geom_blank']
|
|
32
32
|
|
|
@@ -60,7 +60,7 @@ def geom_point(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
60
60
|
'sum' (counts the number of points at each location - might help to workaround overplotting).
|
|
61
61
|
position : str or `FeatureSpec`, default='identity'
|
|
62
62
|
Position adjustment.
|
|
63
|
-
Either a position adjustment name: 'dodge', '
|
|
63
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
64
64
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
65
65
|
show_legend : bool, default=True
|
|
66
66
|
False - do not show legend for this layer.
|
|
@@ -253,7 +253,7 @@ def geom_path(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
253
253
|
'density' (computes and draws kernel density estimate).
|
|
254
254
|
position : str or `FeatureSpec`, default='identity'
|
|
255
255
|
Position adjustment.
|
|
256
|
-
Either a position adjustment name: 'dodge', '
|
|
256
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
257
257
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
258
258
|
show_legend : bool, default=True
|
|
259
259
|
False - do not show legend for this layer.
|
|
@@ -441,7 +441,7 @@ def geom_line(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
441
441
|
'density' (computes and draws kernel density estimate).
|
|
442
442
|
position : str or `FeatureSpec`, default='identity'
|
|
443
443
|
Position adjustment.
|
|
444
|
-
Either a position adjustment name: 'dodge', '
|
|
444
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
445
445
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
446
446
|
show_legend : bool, default=True
|
|
447
447
|
False - do not show legend for this layer.
|
|
@@ -572,7 +572,7 @@ def geom_smooth(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
572
572
|
'density' (computes and draws kernel density estimate).
|
|
573
573
|
position : str or `FeatureSpec`, default='identity'
|
|
574
574
|
Position adjustment.
|
|
575
|
-
Either a position adjustment name: 'dodge', '
|
|
575
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
576
576
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
577
577
|
show_legend : bool, default=True
|
|
578
578
|
False - do not show legend for this layer.
|
|
@@ -758,7 +758,7 @@ def geom_bar(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
758
758
|
'density' (computes and draws kernel density estimate).
|
|
759
759
|
position : str or `FeatureSpec`, default='stack'
|
|
760
760
|
Position adjustment.
|
|
761
|
-
Either a position adjustment name: 'dodge', '
|
|
761
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
762
762
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
763
763
|
show_legend : bool, default=True
|
|
764
764
|
False - do not show legend for this layer.
|
|
@@ -926,7 +926,7 @@ def geom_histogram(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
926
926
|
'density' (computes and draws kernel density estimate).
|
|
927
927
|
position : str or `FeatureSpec`, default='stack'
|
|
928
928
|
Position adjustment.
|
|
929
|
-
Either a position adjustment name: 'dodge', '
|
|
929
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
930
930
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
931
931
|
show_legend : bool, default=True
|
|
932
932
|
False - do not show legend for this layer.
|
|
@@ -1266,7 +1266,7 @@ def geom_bin2d(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
1266
1266
|
The statistical transformation to use on the data for this layer, as a string.
|
|
1267
1267
|
position : str or `FeatureSpec`, default='identity'
|
|
1268
1268
|
Position adjustment.
|
|
1269
|
-
Either a position adjustment name: 'dodge', '
|
|
1269
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
1270
1270
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
1271
1271
|
show_legend : bool, default=True
|
|
1272
1272
|
False - do not show legend for this layer.
|
|
@@ -1443,7 +1443,7 @@ def geom_hex(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
1443
1443
|
The statistical transformation to use on the data for this layer, as a string.
|
|
1444
1444
|
position : str or `FeatureSpec`, default='identity'
|
|
1445
1445
|
Position adjustment.
|
|
1446
|
-
Either a position adjustment name: 'dodge', '
|
|
1446
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
1447
1447
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
1448
1448
|
show_legend : bool, default=True
|
|
1449
1449
|
False - do not show legend for this layer.
|
|
@@ -1637,7 +1637,7 @@ def geom_tile(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
1637
1637
|
The statistical transformation to use on the data for this layer, as a string.
|
|
1638
1638
|
position : str or `FeatureSpec`, default='identity'
|
|
1639
1639
|
Position adjustment.
|
|
1640
|
-
Either a position adjustment name: 'dodge', '
|
|
1640
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
1641
1641
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
1642
1642
|
show_legend : bool, default=True
|
|
1643
1643
|
False - do not show legend for this layer.
|
|
@@ -1810,7 +1810,7 @@ def geom_raster(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
1810
1810
|
The statistical transformation to use on the data for this layer, as a string.
|
|
1811
1811
|
position : str or `FeatureSpec`, default='identity'
|
|
1812
1812
|
Position adjustment.
|
|
1813
|
-
Either a position adjustment name: 'dodge', '
|
|
1813
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
1814
1814
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
1815
1815
|
show_legend : bool, default=True
|
|
1816
1816
|
False - do not show legend for this layer.
|
|
@@ -1910,7 +1910,7 @@ def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
1910
1910
|
'density' (computes and draws kernel density estimate).
|
|
1911
1911
|
position : str or `FeatureSpec`, default='identity'
|
|
1912
1912
|
Position adjustment.
|
|
1913
|
-
Either a position adjustment name: 'dodge', '
|
|
1913
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
1914
1914
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
1915
1915
|
show_legend : bool, default=True
|
|
1916
1916
|
False - do not show legend for this layer.
|
|
@@ -2055,7 +2055,8 @@ def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
2055
2055
|
|
|
2056
2056
|
|
|
2057
2057
|
def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
2058
|
-
manual_key=None, sampling=None,
|
|
2058
|
+
manual_key=None, sampling=None,
|
|
2059
|
+
tooltips=None, labels=None,
|
|
2059
2060
|
fatten=None,
|
|
2060
2061
|
width_unit=None,
|
|
2061
2062
|
color_by=None, fill_by=None,
|
|
@@ -2079,9 +2080,9 @@ def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
2079
2080
|
'bin' (counts number of points with x-axis coordinate in the same bin),
|
|
2080
2081
|
'smooth' (performs smoothing - linear default),
|
|
2081
2082
|
'density' (computes and draws kernel density estimate).
|
|
2082
|
-
position : str or `FeatureSpec`, default=
|
|
2083
|
+
position : str or `FeatureSpec`, default=position_dodge(width=.95)
|
|
2083
2084
|
Position adjustment.
|
|
2084
|
-
Either a position adjustment name: 'dodge', '
|
|
2085
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
2085
2086
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
2086
2087
|
show_legend : bool, default=True
|
|
2087
2088
|
False - do not show legend for this layer.
|
|
@@ -2203,6 +2204,7 @@ def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
2203
2204
|
manual_key=manual_key,
|
|
2204
2205
|
sampling=sampling,
|
|
2205
2206
|
tooltips=tooltips,
|
|
2207
|
+
labels=labels,
|
|
2206
2208
|
fatten=fatten,
|
|
2207
2209
|
width_unit=width_unit,
|
|
2208
2210
|
color_by=color_by, fill_by=fill_by,
|
|
@@ -2235,7 +2237,7 @@ def geom_pointrange(mapping=None, *, data=None, stat=None, position=None, show_l
|
|
|
2235
2237
|
'density' (computes and draws kernel density estimate).
|
|
2236
2238
|
position : str or `FeatureSpec`, default='identity'
|
|
2237
2239
|
Position adjustment.
|
|
2238
|
-
Either a position adjustment name: 'dodge', '
|
|
2240
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
2239
2241
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
2240
2242
|
show_legend : bool, default=True
|
|
2241
2243
|
False - do not show legend for this layer.
|
|
@@ -2376,7 +2378,7 @@ def geom_linerange(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
2376
2378
|
'density' (computes and draws kernel density estimate).
|
|
2377
2379
|
position : str or `FeatureSpec`, default='identity'
|
|
2378
2380
|
Position adjustment.
|
|
2379
|
-
Either a position adjustment name: 'dodge', '
|
|
2381
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
2380
2382
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
2381
2383
|
show_legend : bool, default=True
|
|
2382
2384
|
False - do not show legend for this layer.
|
|
@@ -2503,7 +2505,7 @@ def geom_contour(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
2503
2505
|
The statistical transformation to use on the data for this layer, as a string.
|
|
2504
2506
|
position : str or `FeatureSpec`, default='identity'
|
|
2505
2507
|
Position adjustment.
|
|
2506
|
-
Either a position adjustment name: 'dodge', '
|
|
2508
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
2507
2509
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
2508
2510
|
show_legend : bool, default=True
|
|
2509
2511
|
False - do not show legend for this layer.
|
|
@@ -2657,7 +2659,7 @@ def geom_contourf(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
2657
2659
|
The statistical transformation to use on the data for this layer, as a string.
|
|
2658
2660
|
position : str or `FeatureSpec`, default='identity'
|
|
2659
2661
|
Position adjustment.
|
|
2660
|
-
Either a position adjustment name: 'dodge', '
|
|
2662
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
2661
2663
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
2662
2664
|
show_legend : bool, default=True
|
|
2663
2665
|
False - do not show legend for this layer.
|
|
@@ -2807,7 +2809,7 @@ def geom_polygon(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
2807
2809
|
The statistical transformation to use on the data for this layer, as a string.
|
|
2808
2810
|
position : str or `FeatureSpec`, default='identity'
|
|
2809
2811
|
Position adjustment.
|
|
2810
|
-
Either a position adjustment name: 'dodge', '
|
|
2812
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
2811
2813
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
2812
2814
|
show_legend : bool, default=True
|
|
2813
2815
|
False - do not show legend for this layer.
|
|
@@ -2998,7 +3000,7 @@ def geom_map(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
2998
3000
|
'density' (computes and draws kernel density estimate).
|
|
2999
3001
|
position : str or `FeatureSpec`, default='identity'
|
|
3000
3002
|
Position adjustment.
|
|
3001
|
-
Either a position adjustment name: 'dodge', '
|
|
3003
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
3002
3004
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
3003
3005
|
show_legend : bool, default=True
|
|
3004
3006
|
False - do not show legend for this layer.
|
|
@@ -3170,7 +3172,7 @@ def geom_abline(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
3170
3172
|
The statistical transformation to use on the data for this layer, as a string.
|
|
3171
3173
|
position : str or `FeatureSpec`, default='identity'
|
|
3172
3174
|
Position adjustment.
|
|
3173
|
-
Either a position adjustment name: 'dodge', '
|
|
3175
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
3174
3176
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
3175
3177
|
show_legend : bool, default=True
|
|
3176
3178
|
False - do not show legend for this layer.
|
|
@@ -3285,7 +3287,7 @@ def geom_band(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
3285
3287
|
The statistical transformation to use on the data for this layer, as a string.
|
|
3286
3288
|
position : str or `FeatureSpec`, default='identity'
|
|
3287
3289
|
Position adjustment.
|
|
3288
|
-
Either a position adjustment name: 'dodge', '
|
|
3290
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
3289
3291
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
3290
3292
|
show_legend : bool, default=True
|
|
3291
3293
|
False - do not show legend for this layer.
|
|
@@ -3399,7 +3401,7 @@ def geom_hline(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
3399
3401
|
The statistical transformation to use on the data for this layer, as a string.
|
|
3400
3402
|
position : str or `FeatureSpec`, default='identity'
|
|
3401
3403
|
Position adjustment.
|
|
3402
|
-
Either a position adjustment name: 'dodge', '
|
|
3404
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
3403
3405
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
3404
3406
|
show_legend : bool, default=True
|
|
3405
3407
|
False - do not show legend for this layer.
|
|
@@ -3524,7 +3526,7 @@ def geom_vline(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
3524
3526
|
The statistical transformation to use on the data for this layer, as a string.
|
|
3525
3527
|
position : str or `FeatureSpec`, default='identity'
|
|
3526
3528
|
Position adjustment.
|
|
3527
|
-
Either a position adjustment name: 'dodge', '
|
|
3529
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
3528
3530
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
3529
3531
|
show_legend : bool, default=True
|
|
3530
3532
|
False - do not show legend for this layer.
|
|
@@ -3654,9 +3656,9 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
3654
3656
|
is inherited from the plot data as specified in the call to ggplot.
|
|
3655
3657
|
stat : str, default='boxplot'
|
|
3656
3658
|
The statistical transformation to use on the data for this layer, as a string.
|
|
3657
|
-
position : str or `FeatureSpec`, default=
|
|
3659
|
+
position : str or `FeatureSpec`, default=position_dodge(width=.95)
|
|
3658
3660
|
Position adjustment.
|
|
3659
|
-
Either a position adjustment name: 'dodge', '
|
|
3661
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
3660
3662
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
3661
3663
|
show_legend : bool, default=True
|
|
3662
3664
|
False - do not show legend for this layer.
|
|
@@ -3729,12 +3731,12 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
3729
3731
|
|
|
3730
3732
|
`geom_boxplot()` understands the following aesthetics mappings:
|
|
3731
3733
|
|
|
3732
|
-
- x : x-axis coordinates.
|
|
3733
|
-
- lower : lower hinge.
|
|
3734
|
-
- middle : median.
|
|
3735
|
-
- upper : upper hinge.
|
|
3736
|
-
- ymin : lower whisker.
|
|
3737
|
-
- ymax : upper whisker.
|
|
3734
|
+
- x or y: x-axis or y-axis coordinates for vertical or horizontal boxplot, respectively.
|
|
3735
|
+
- lower or xlower : lower hinge.
|
|
3736
|
+
- middle or xmiddle : median.
|
|
3737
|
+
- upper or xupper : upper hinge.
|
|
3738
|
+
- ymin or xmin : lower whisker.
|
|
3739
|
+
- ymax or xmax : upper whisker.
|
|
3738
3740
|
- alpha : transparency level of a layer. Accept values between 0 and 1.
|
|
3739
3741
|
- color (colour) : color of the geometry lines. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|
|
3740
3742
|
- fill : fill color. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|
|
@@ -3890,9 +3892,9 @@ def geom_violin(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
3890
3892
|
is inherited from the plot data as specified in the call to ggplot.
|
|
3891
3893
|
stat : str, default='ydensity'
|
|
3892
3894
|
The statistical transformation to use on the data for this layer, as a string.
|
|
3893
|
-
position : str or `FeatureSpec`, default=
|
|
3895
|
+
position : str or `FeatureSpec`, default=position_dodge(width=.95)
|
|
3894
3896
|
Position adjustment.
|
|
3895
|
-
Either a position adjustment name: 'dodge', '
|
|
3897
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
3896
3898
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
3897
3899
|
show_legend : bool, default=True
|
|
3898
3900
|
False - do not show legend for this layer.
|
|
@@ -3917,7 +3919,7 @@ def geom_violin(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
3917
3919
|
If 1, another half is drawn.
|
|
3918
3920
|
If 0, violins look as usual.
|
|
3919
3921
|
quantiles : list of float, default=[0.25, 0.5, 0.75]
|
|
3920
|
-
|
|
3922
|
+
A list of quantiles to be calculated and written to the `..quantile..` variable.
|
|
3921
3923
|
quantile_lines : bool, default=False
|
|
3922
3924
|
Show the quantile lines.
|
|
3923
3925
|
scale : {'area', 'count', 'width'}, default='area'
|
|
@@ -4098,6 +4100,209 @@ def geom_violin(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
4098
4100
|
**other_args)
|
|
4099
4101
|
|
|
4100
4102
|
|
|
4103
|
+
def geom_sina(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
4104
|
+
manual_key=None, sampling=None,
|
|
4105
|
+
tooltips=None,
|
|
4106
|
+
orientation=None,
|
|
4107
|
+
seed=None,
|
|
4108
|
+
show_half=None,
|
|
4109
|
+
quantiles=None,
|
|
4110
|
+
scale=None, trim=None, tails_cutoff=None, kernel=None, bw=None, adjust=None, n=None, fs_max=None,
|
|
4111
|
+
color_by=None, fill_by=None,
|
|
4112
|
+
**other_args):
|
|
4113
|
+
"""
|
|
4114
|
+
A sina plot visualizes a single variable across classes, with jitter width reflecting the data density in each class.
|
|
4115
|
+
|
|
4116
|
+
Parameters
|
|
4117
|
+
----------
|
|
4118
|
+
mapping : `FeatureSpec`
|
|
4119
|
+
Set of aesthetic mappings created by `aes()` function.
|
|
4120
|
+
Aesthetic mappings describe the way that variables in the data are
|
|
4121
|
+
mapped to plot "aesthetics".
|
|
4122
|
+
data : dict or Pandas or Polars `DataFrame`
|
|
4123
|
+
The data to be displayed in this layer. If None, the default, the data
|
|
4124
|
+
is inherited from the plot data as specified in the call to ggplot.
|
|
4125
|
+
stat : str, default='sina'
|
|
4126
|
+
The statistical transformation to use on the data for this layer, as a string.
|
|
4127
|
+
position : str or `FeatureSpec`, default=position_dodge(width=.95)
|
|
4128
|
+
Position adjustment.
|
|
4129
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
4130
|
+
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
4131
|
+
show_legend : bool, default=True
|
|
4132
|
+
False - do not show legend for this layer.
|
|
4133
|
+
inherit_aes : bool, default=True
|
|
4134
|
+
False - do not combine the layer aesthetic mappings with the plot shared mappings.
|
|
4135
|
+
manual_key : str or `layer_key`
|
|
4136
|
+
The key to show in the manual legend.
|
|
4137
|
+
Specify text for the legend label or advanced settings using the `layer_key()` function.
|
|
4138
|
+
sampling : `FeatureSpec`
|
|
4139
|
+
Result of the call to the `sampling_xxx()` function.
|
|
4140
|
+
To prevent any sampling for this layer pass value "none" (string "none").
|
|
4141
|
+
tooltips : `layer_tooltips`
|
|
4142
|
+
Result of the call to the `layer_tooltips()` function.
|
|
4143
|
+
Specify appearance, style and content.
|
|
4144
|
+
Set tooltips='none' to hide tooltips from the layer.
|
|
4145
|
+
orientation : str
|
|
4146
|
+
Specify the axis that the layer's stat and geom should run along.
|
|
4147
|
+
The default value (None) automatically determines the orientation based on the aesthetic mapping.
|
|
4148
|
+
If the automatic detection doesn't work, it can be set explicitly by specifying the 'x' or 'y' orientation.
|
|
4149
|
+
seed : int
|
|
4150
|
+
A random seed to make the jitter reproducible.
|
|
4151
|
+
If None (the default value), the seed is initialised with a random value.
|
|
4152
|
+
show_half : float, default=0
|
|
4153
|
+
If -1, only half of each group is drawn.
|
|
4154
|
+
If 1, another half is drawn.
|
|
4155
|
+
If 0, sina look as usual.
|
|
4156
|
+
quantiles : list of float, default=[0.25, 0.5, 0.75]
|
|
4157
|
+
A list of quantiles to be calculated and written to the `..quantile..` variable.
|
|
4158
|
+
scale : {'area', 'count', 'width'}, default='area'
|
|
4159
|
+
If 'area', all groups have the same area.
|
|
4160
|
+
If 'count', areas are scaled proportionally to the number of observations.
|
|
4161
|
+
If 'width', all groups have the same maximum width.
|
|
4162
|
+
trim : bool, default=True
|
|
4163
|
+
Trim the tails of the violins, which limit the area for sina points, to the range of the data.
|
|
4164
|
+
tails_cutoff : float, default=3.0
|
|
4165
|
+
Extend domain of each violin, which limit the area for sina points, on `tails_cutoff * bw` if `trim=False`.
|
|
4166
|
+
kernel : str, default='gaussian'
|
|
4167
|
+
The kernel we use to calculate the density function.
|
|
4168
|
+
Choose among 'gaussian', 'cosine', 'optcosine', 'rectangular' (or 'uniform'),
|
|
4169
|
+
'triangular', 'biweight' (or 'quartic'), 'epanechikov' (or 'parabolic').
|
|
4170
|
+
bw : str or float
|
|
4171
|
+
The method (or exact value) of bandwidth.
|
|
4172
|
+
Either a string (choose among 'nrd0' and 'nrd'), or a float.
|
|
4173
|
+
adjust : float
|
|
4174
|
+
Adjust the value of bandwidth by multiplying it. Change how smooth the frequency curve is.
|
|
4175
|
+
n : int, default=512
|
|
4176
|
+
The number of sampled points for plotting the function, that limit the area for sina points.
|
|
4177
|
+
fs_max : int, default=500
|
|
4178
|
+
Maximum size of data to use density computation with 'full scan'.
|
|
4179
|
+
For bigger data, less accurate but more efficient density computation is applied.
|
|
4180
|
+
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
4181
|
+
Define the color aesthetic for the geometry.
|
|
4182
|
+
fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
|
|
4183
|
+
Define the fill aesthetic for the geometry.
|
|
4184
|
+
other_args
|
|
4185
|
+
Other arguments passed on to the layer.
|
|
4186
|
+
These are often aesthetics settings used to set an aesthetic to a fixed value,
|
|
4187
|
+
like color='red', fill='blue', size=3 or shape=21.
|
|
4188
|
+
They may also be parameters to the paired geom/stat.
|
|
4189
|
+
|
|
4190
|
+
Returns
|
|
4191
|
+
-------
|
|
4192
|
+
`LayerSpec`
|
|
4193
|
+
Geom object specification.
|
|
4194
|
+
|
|
4195
|
+
Notes
|
|
4196
|
+
-----
|
|
4197
|
+
Computed variables:
|
|
4198
|
+
|
|
4199
|
+
- ..violinwidth.. : density scaled for the sina plot, according to area, counts or to a constant maximum width (mapped by default).
|
|
4200
|
+
- ..density.. : density estimate.
|
|
4201
|
+
- ..count.. : density * number of points.
|
|
4202
|
+
- ..scaled.. : density estimate, scaled to maximum of 1.
|
|
4203
|
+
- ..quantile.. : quantile estimate.
|
|
4204
|
+
|
|
4205
|
+
`geom_sina()` understands the following aesthetics mappings:
|
|
4206
|
+
|
|
4207
|
+
- x : x-axis value.
|
|
4208
|
+
- y : y-axis value.
|
|
4209
|
+
- alpha : transparency level of a point. Accept values between 0 and 1.
|
|
4210
|
+
- color (colour) : color of the geometry. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|
|
4211
|
+
- fill : fill color. Is applied only to the points of shapes having inner area. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|
|
4212
|
+
- shape : shape of the point, an integer from 0 to 25. For more info see `Point Shapes <https://lets-plot.org/python/pages/aesthetics.html#point-shapes>`__.
|
|
4213
|
+
- size : size of the point.
|
|
4214
|
+
- stroke : width of the shape border. Applied only to the shapes having border.
|
|
4215
|
+
- weight : used by 'sina' stat to compute weighted density.
|
|
4216
|
+
- quantile : quantile values.
|
|
4217
|
+
- width : maximal width of sina plot. Typically ranges between 0 and 1. Values that are greater than 1 lead to overlapping of the geometries.
|
|
4218
|
+
|
|
4219
|
+
----
|
|
4220
|
+
|
|
4221
|
+
To hide axis tooltips, set 'blank' or the result of `element_blank()`
|
|
4222
|
+
to the `axis_tooltip`, `axis_tooltip_x` or `axis_tooltip_y` parameter of the `theme()`.
|
|
4223
|
+
|
|
4224
|
+
Examples
|
|
4225
|
+
--------
|
|
4226
|
+
.. jupyter-execute::
|
|
4227
|
+
:linenos:
|
|
4228
|
+
:emphasize-lines: 10
|
|
4229
|
+
|
|
4230
|
+
import numpy as np
|
|
4231
|
+
from lets_plot import *
|
|
4232
|
+
LetsPlot.setup_html()
|
|
4233
|
+
n = 100
|
|
4234
|
+
np.random.seed(42)
|
|
4235
|
+
x = np.random.choice(['a', 'b', 'c'], size=n)
|
|
4236
|
+
y = np.random.randint(10, size=n)
|
|
4237
|
+
ggplot({'x': x, 'y': y}, aes(x='x', y='y')) + \\
|
|
4238
|
+
geom_violin() + \\
|
|
4239
|
+
geom_sina(seed=42)
|
|
4240
|
+
|
|
4241
|
+
|
|
|
4242
|
+
|
|
4243
|
+
.. jupyter-execute::
|
|
4244
|
+
:linenos:
|
|
4245
|
+
:emphasize-lines: 12
|
|
4246
|
+
|
|
4247
|
+
import numpy as np
|
|
4248
|
+
from lets_plot import *
|
|
4249
|
+
LetsPlot.setup_html()
|
|
4250
|
+
n = 100
|
|
4251
|
+
np.random.seed(42)
|
|
4252
|
+
x = np.random.choice(['a', 'b', 'b', 'c'], size=n)
|
|
4253
|
+
y = np.random.normal(size=n)
|
|
4254
|
+
quantiles = [.02, .25, .5, .75, .98]
|
|
4255
|
+
ggplot({'x': x, 'y': y}, aes('x', 'y')) + \\
|
|
4256
|
+
geom_violin(aes(fill='..quantile..'), scale='count', alpha=.5, \\
|
|
4257
|
+
quantiles=quantiles, quantile_lines=True) + \\
|
|
4258
|
+
geom_sina(aes(color='..quantile..'), scale='count', quantiles=quantiles, seed=42) + \\
|
|
4259
|
+
scale_continuous(['color', 'fill'], low="black", high="#6baed6")
|
|
4260
|
+
|
|
4261
|
+
|
|
|
4262
|
+
|
|
4263
|
+
.. jupyter-execute::
|
|
4264
|
+
:linenos:
|
|
4265
|
+
:emphasize-lines: 14-17
|
|
4266
|
+
|
|
4267
|
+
import numpy as np
|
|
4268
|
+
from lets_plot import *
|
|
4269
|
+
LetsPlot.setup_html()
|
|
4270
|
+
n = 100
|
|
4271
|
+
np.random.seed(42)
|
|
4272
|
+
x = np.random.choice(["a", "b", "c", "d"], size=n)
|
|
4273
|
+
y1 = np.random.normal(size=n)
|
|
4274
|
+
y2 = np.random.normal(size=n)
|
|
4275
|
+
ggplot({'x': x, 'y1': y1, 'y2': y2}) + \\
|
|
4276
|
+
geom_violin(aes('x', 'y1'), show_half=-1, \\
|
|
4277
|
+
trim=False, fill='#ffffb2') + \\
|
|
4278
|
+
geom_violin(aes('x', 'y2'), show_half=1, \\
|
|
4279
|
+
trim=False, fill='#74c476') + \\
|
|
4280
|
+
geom_sina(aes('x', 'y1'), show_half=-1, \\
|
|
4281
|
+
fill='#ffffb2', shape=24, size=2, seed=42) + \\
|
|
4282
|
+
geom_sina(aes('x', 'y2'), show_half=1, \\
|
|
4283
|
+
fill='#74c476', shape=25, size=2, seed=42)
|
|
4284
|
+
|
|
4285
|
+
"""
|
|
4286
|
+
return _geom('sina',
|
|
4287
|
+
mapping=mapping,
|
|
4288
|
+
data=data,
|
|
4289
|
+
stat=stat,
|
|
4290
|
+
position=position,
|
|
4291
|
+
show_legend=show_legend,
|
|
4292
|
+
inherit_aes=inherit_aes,
|
|
4293
|
+
manual_key=manual_key,
|
|
4294
|
+
sampling=sampling,
|
|
4295
|
+
tooltips=tooltips,
|
|
4296
|
+
orientation=orientation,
|
|
4297
|
+
seed=seed,
|
|
4298
|
+
show_half=show_half,
|
|
4299
|
+
quantiles=quantiles,
|
|
4300
|
+
scale=scale, trim=trim, tails_cutoff=tails_cutoff, kernel=kernel, bw=bw, adjust=adjust, n=n,
|
|
4301
|
+
fs_max=fs_max,
|
|
4302
|
+
color_by=color_by, fill_by=fill_by,
|
|
4303
|
+
**other_args)
|
|
4304
|
+
|
|
4305
|
+
|
|
4101
4306
|
def geom_ydotplot(mapping=None, *, data=None, show_legend=None, inherit_aes=None,
|
|
4102
4307
|
manual_key=None, sampling=None,
|
|
4103
4308
|
tooltips=None,
|
|
@@ -4316,7 +4521,7 @@ def geom_area_ridges(mapping=None, *, data=None, stat=None, position=None, show_
|
|
|
4316
4521
|
'densityridges' (computes and draws kernel density estimate for each ridge).
|
|
4317
4522
|
position : str or `FeatureSpec`, default='identity'
|
|
4318
4523
|
Position adjustment.
|
|
4319
|
-
Either a position adjustment name: 'dodge', '
|
|
4524
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
4320
4525
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
4321
4526
|
show_legend : bool, default=True
|
|
4322
4527
|
False - do not show legend for this layer.
|
|
@@ -4504,7 +4709,7 @@ def geom_ribbon(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
4504
4709
|
The statistical transformation to use on the data for this layer, as a string.
|
|
4505
4710
|
position : str or `FeatureSpec`, default='identity'
|
|
4506
4711
|
Position adjustment.
|
|
4507
|
-
Either a position adjustment name: 'dodge', '
|
|
4712
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
4508
4713
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
4509
4714
|
show_legend : bool, default=True
|
|
4510
4715
|
False - do not show legend for this layer.
|
|
@@ -4635,7 +4840,7 @@ def geom_area(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
4635
4840
|
'density' (computes and draws kernel density estimate).
|
|
4636
4841
|
position : str or `FeatureSpec`, default='gstack'
|
|
4637
4842
|
Position adjustment.
|
|
4638
|
-
Either a position adjustment name: 'dodge', '
|
|
4843
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
4639
4844
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
4640
4845
|
show_legend : bool, default=True
|
|
4641
4846
|
False - do not show legend for this layer.
|
|
@@ -4780,7 +4985,7 @@ def geom_density(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
4780
4985
|
'density' (computes and draws kernel density estimate).
|
|
4781
4986
|
position : str or `FeatureSpec`, default='identity'
|
|
4782
4987
|
Position adjustment.
|
|
4783
|
-
Either a position adjustment name: 'dodge', '
|
|
4988
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
4784
4989
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
4785
4990
|
show_legend : bool, default=True
|
|
4786
4991
|
False - do not show legend for this layer.
|
|
@@ -5000,7 +5205,7 @@ def geom_density2d(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
5000
5205
|
The statistical transformation to use on the data for this layer, as a string.
|
|
5001
5206
|
position : str or `FeatureSpec`, default='identity'
|
|
5002
5207
|
Position adjustment.
|
|
5003
|
-
Either a position adjustment name: 'dodge', '
|
|
5208
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
5004
5209
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
5005
5210
|
show_legend : bool, default=True
|
|
5006
5211
|
False - do not show legend for this layer.
|
|
@@ -5236,7 +5441,7 @@ def geom_density2df(mapping=None, *, data=None, stat=None, position=None, show_l
|
|
|
5236
5441
|
The statistical transformation to use on the data for this layer, as a string.
|
|
5237
5442
|
position : str or `FeatureSpec`, default='identity'
|
|
5238
5443
|
Position adjustment.
|
|
5239
|
-
Either a position adjustment name: 'dodge', '
|
|
5444
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
5240
5445
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
5241
5446
|
show_legend : bool, default=True
|
|
5242
5447
|
False - do not show legend for this layer.
|
|
@@ -5471,9 +5676,9 @@ def geom_jitter(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
5471
5676
|
'bin' (counts number of points with x-axis coordinate in the same bin),
|
|
5472
5677
|
'smooth' (performs smoothing - linear default),
|
|
5473
5678
|
'density' (computes and draws kernel density estimate).
|
|
5474
|
-
position : str or `FeatureSpec`, default=
|
|
5679
|
+
position : str or `FeatureSpec`, default=position_jitter(width=.4, height=.4)
|
|
5475
5680
|
Position adjustment.
|
|
5476
|
-
Either a position adjustment name: 'dodge', '
|
|
5681
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
5477
5682
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
5478
5683
|
show_legend : bool, default=True
|
|
5479
5684
|
False - do not show legend for this layer.
|
|
@@ -5617,7 +5822,7 @@ def geom_qq(mapping=None, *, data=None, stat=None, position=None, show_legend=No
|
|
|
5617
5822
|
'density' (computes and draws kernel density estimate).
|
|
5618
5823
|
position : str or `FeatureSpec`, default='identity'
|
|
5619
5824
|
Position adjustment.
|
|
5620
|
-
Either a position adjustment name: 'dodge', '
|
|
5825
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
5621
5826
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
5622
5827
|
show_legend : bool, default=True
|
|
5623
5828
|
False - do not show legend for this layer.
|
|
@@ -5759,7 +5964,7 @@ def geom_qq2(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
5759
5964
|
'density' (computes and draws kernel density estimate).
|
|
5760
5965
|
position : str or `FeatureSpec`, default='identity'
|
|
5761
5966
|
Position adjustment.
|
|
5762
|
-
Either a position adjustment name: 'dodge', '
|
|
5967
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
5763
5968
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
5764
5969
|
show_legend : bool, default=True
|
|
5765
5970
|
False - do not show legend for this layer.
|
|
@@ -5877,7 +6082,7 @@ def geom_qq_line(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
5877
6082
|
'density' (computes and draws kernel density estimate).
|
|
5878
6083
|
position : str or `FeatureSpec`, default='identity'
|
|
5879
6084
|
Position adjustment.
|
|
5880
|
-
Either a position adjustment name: 'dodge', '
|
|
6085
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
5881
6086
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
5882
6087
|
show_legend : bool, default=True
|
|
5883
6088
|
False - do not show legend for this layer.
|
|
@@ -6012,7 +6217,7 @@ def geom_qq2_line(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
6012
6217
|
'density' (computes and draws kernel density estimate).
|
|
6013
6218
|
position : str or `FeatureSpec`, default='identity'
|
|
6014
6219
|
Position adjustment.
|
|
6015
|
-
Either a position adjustment name: 'dodge', '
|
|
6220
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
6016
6221
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
6017
6222
|
show_legend : bool, default=True
|
|
6018
6223
|
False - do not show legend for this layer.
|
|
@@ -6115,7 +6320,7 @@ def geom_freqpoly(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
6115
6320
|
'density' (computes and draws kernel density estimate).
|
|
6116
6321
|
position : str or `FeatureSpec`, default='identity'
|
|
6117
6322
|
Position adjustment.
|
|
6118
|
-
Either a position adjustment name: 'dodge', '
|
|
6323
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
6119
6324
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
6120
6325
|
show_legend : bool, default=True
|
|
6121
6326
|
False - do not show legend for this layer.
|
|
@@ -6244,7 +6449,7 @@ def geom_step(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
6244
6449
|
'density' (computes and draws kernel density estimate).
|
|
6245
6450
|
position : str or `FeatureSpec`, default='identity'
|
|
6246
6451
|
Position adjustment.
|
|
6247
|
-
Either a position adjustment name: 'dodge', '
|
|
6452
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
6248
6453
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
6249
6454
|
show_legend : bool, default=True
|
|
6250
6455
|
False - do not show legend for this layer.
|
|
@@ -6366,7 +6571,7 @@ def geom_rect(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
6366
6571
|
The statistical transformation to use on the data for this layer, as a string.
|
|
6367
6572
|
position : str or `FeatureSpec`, default='identity'
|
|
6368
6573
|
Position adjustment.
|
|
6369
|
-
Either a position adjustment name: 'dodge', '
|
|
6574
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
6370
6575
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
6371
6576
|
show_legend : bool, default=True
|
|
6372
6577
|
False - do not show legend for this layer.
|
|
@@ -6545,7 +6750,7 @@ def geom_segment(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
6545
6750
|
'density' (computes and draws kernel density estimate).
|
|
6546
6751
|
position : str or `FeatureSpec`, default='identity'
|
|
6547
6752
|
Position adjustment.
|
|
6548
|
-
Either a position adjustment name: 'dodge', '
|
|
6753
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
6549
6754
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
6550
6755
|
show_legend : bool, default=True
|
|
6551
6756
|
False - do not show legend for this layer.
|
|
@@ -6707,7 +6912,7 @@ def geom_curve(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
6707
6912
|
'density' (computes and draws kernel density estimate).
|
|
6708
6913
|
position : str or `FeatureSpec`, default='identity'
|
|
6709
6914
|
Position adjustment.
|
|
6710
|
-
Either a position adjustment name: 'dodge', '
|
|
6915
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
6711
6916
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
6712
6917
|
show_legend : bool, default=True
|
|
6713
6918
|
False - do not show legend for this layer.
|
|
@@ -6860,7 +7065,7 @@ def geom_spoke(mapping=None, *, data=None, position=None, show_legend=None, inhe
|
|
|
6860
7065
|
is inherited from the plot data as specified in the call to ggplot.
|
|
6861
7066
|
position : str or `FeatureSpec`, default='identity'
|
|
6862
7067
|
Position adjustment.
|
|
6863
|
-
Either a position adjustment name: 'dodge', '
|
|
7068
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
6864
7069
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
6865
7070
|
show_legend : bool, default=True
|
|
6866
7071
|
False - do not show legend for this layer.
|
|
@@ -7012,7 +7217,7 @@ def geom_text(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
7012
7217
|
'density' (computes and draws kernel density estimate).
|
|
7013
7218
|
position : str or `FeatureSpec`, default='identity'
|
|
7014
7219
|
Position adjustment.
|
|
7015
|
-
Either a position adjustment name: 'dodge', '
|
|
7220
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
7016
7221
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
7017
7222
|
show_legend : bool, default=True
|
|
7018
7223
|
False - do not show legend for this layer.
|
|
@@ -7094,8 +7299,8 @@ def geom_text(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
7094
7299
|
- label : text to add to plot.
|
|
7095
7300
|
- family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
7096
7301
|
- fontface : font style and weight. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
7097
|
-
- hjust : horizontal text alignment. Possible values: 'left'
|
|
7098
|
-
- vjust : vertical text alignment. Possible values: 'bottom', 'center'
|
|
7302
|
+
- hjust : horizontal text alignment relative to the x-coordinate. Possible values: 0 or 'left' - left-aligned (text starts at x), 0.5 or 'middle' (default) - text is centered on x, 1 or 'right' - right-aligned (text ends at x). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
7303
|
+
- vjust : vertical text alignment relative to the y-coordinate. Possible values: 0 or 'bottom' - bottom-aligned (bottom of text at y), 0.5 or 'center' (default) - middle of text at y, 1 or 'top' - top-aligned (top of text at y). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
7099
7304
|
- angle : text rotation angle in degrees.
|
|
7100
7305
|
- lineheight : line height multiplier applied to the font size in the case of multi-line text.
|
|
7101
7306
|
|
|
@@ -7258,7 +7463,7 @@ def geom_label(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
7258
7463
|
'density' (computes and draws kernel density estimate).
|
|
7259
7464
|
position : str or `FeatureSpec`, default='identity'
|
|
7260
7465
|
Position adjustment.
|
|
7261
|
-
Either a position adjustment name: 'dodge', '
|
|
7466
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
7262
7467
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
7263
7468
|
show_legend : bool, default=True
|
|
7264
7469
|
False - do not show legend for this layer.
|
|
@@ -7351,8 +7556,8 @@ def geom_label(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
7351
7556
|
- label : text to add to plot.
|
|
7352
7557
|
- family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
7353
7558
|
- fontface : font style and weight. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
7354
|
-
- hjust : horizontal alignment. Possible values: 'left'
|
|
7355
|
-
- vjust : vertical alignment. Possible values: 'bottom', 'center'
|
|
7559
|
+
- hjust : horizontal text alignment relative to the x-coordinate. Possible values: 0 or 'left' - left-aligned (text starts at x), 0.5 or 'middle' (default) - text is centered on x, 1 or 'right' - right-aligned (text ends at x). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
7560
|
+
- vjust : vertical text alignment relative to the y-coordinate. Possible values: 0 or 'bottom' - bottom-aligned (bottom of text at y), 0.5 or 'center' (default) - middle of text at y, 1 or 'top' - top-aligned (top of text at y). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
7356
7561
|
- angle : rotation angle in degrees.
|
|
7357
7562
|
- lineheight : line height multiplier applied to the font size in the case of multi-line text.
|
|
7358
7563
|
|
|
@@ -7484,20 +7689,29 @@ def geom_label(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
7484
7689
|
color_by=color_by, fill_by=fill_by,
|
|
7485
7690
|
**other_args)
|
|
7486
7691
|
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7692
|
+
def geom_text_repel(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
7693
|
+
manual_key=None, sampling=None,
|
|
7694
|
+
tooltips=None,
|
|
7695
|
+
map=None, map_join=None, use_crs=None,
|
|
7696
|
+
label_format=None,
|
|
7697
|
+
na_text=None,
|
|
7698
|
+
nudge_x=None, nudge_y=None,
|
|
7699
|
+
size_unit=None,
|
|
7700
|
+
nudge_unit=None,
|
|
7701
|
+
check_overlap=None,
|
|
7702
|
+
color_by=None,
|
|
7703
|
+
seed=None,
|
|
7704
|
+
max_iter=None,
|
|
7705
|
+
max_time=None,
|
|
7706
|
+
direction=None,
|
|
7707
|
+
point_padding=None,
|
|
7708
|
+
box_padding=None,
|
|
7709
|
+
max_overlaps=None,
|
|
7710
|
+
min_segment_length=None,
|
|
7711
|
+
arrow=None,
|
|
7712
|
+
**other_args):
|
|
7499
7713
|
"""
|
|
7500
|
-
|
|
7714
|
+
Add text labels that repel away from each other and from data points.
|
|
7501
7715
|
|
|
7502
7716
|
Parameters
|
|
7503
7717
|
----------
|
|
@@ -7508,10 +7722,13 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
7508
7722
|
data : dict or Pandas or Polars `DataFrame` or `GeoDataFrame`
|
|
7509
7723
|
The data to be displayed in this layer. If None, the default, the data
|
|
7510
7724
|
is inherited from the plot data as specified in the call to ggplot.
|
|
7511
|
-
stat : str, default='
|
|
7725
|
+
stat : str, default='identity'
|
|
7512
7726
|
The statistical transformation to use on the data for this layer, as a string.
|
|
7513
7727
|
Supported transformations: 'identity' (leaves the data unchanged),
|
|
7514
|
-
'
|
|
7728
|
+
'count' (counts number of points with same x-axis coordinate),
|
|
7729
|
+
'bin' (counts number of points with x-axis coordinate in the same bin),
|
|
7730
|
+
'smooth' (performs smoothing - linear default),
|
|
7731
|
+
'density' (computes and draws kernel density estimate).
|
|
7515
7732
|
position : str or `FeatureSpec`, default='identity'
|
|
7516
7733
|
Position adjustment.
|
|
7517
7734
|
Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
@@ -7530,9 +7747,6 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
7530
7747
|
Result of the call to the `layer_tooltips()` function.
|
|
7531
7748
|
Specify appearance, style and content.
|
|
7532
7749
|
Set tooltips='none' to hide tooltips from the layer.
|
|
7533
|
-
labels : `layer_labels`
|
|
7534
|
-
Result of the call to the `layer_labels()` function.
|
|
7535
|
-
Specify style and content of the annotations.
|
|
7536
7750
|
map : `GeoDataFrame` or `Geocoder`
|
|
7537
7751
|
Data containing coordinates of points.
|
|
7538
7752
|
map_join : str or list
|
|
@@ -7544,13 +7758,440 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
7544
7758
|
If an EPSG code is given, then all the coordinates in `GeoDataFrame` (see the `map` parameter)
|
|
7545
7759
|
will be projected to this CRS.
|
|
7546
7760
|
Specify "provided" to disable any further re-projection and to keep the `GeoDataFrame's` original CRS.
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7761
|
+
label_format : str
|
|
7762
|
+
Format used to transform label mapping values to a string.
|
|
7763
|
+
Examples:
|
|
7764
|
+
|
|
7765
|
+
- '.2f' -> '12.45'
|
|
7766
|
+
- 'Num {}' -> 'Num 12.456789'
|
|
7767
|
+
- 'TTL: {.2f}$' -> 'TTL: 12.45$'
|
|
7768
|
+
|
|
7769
|
+
For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
|
|
7770
|
+
na_text : str, default='n/a'
|
|
7771
|
+
Text to show for missing values.
|
|
7772
|
+
nudge_x : float
|
|
7773
|
+
Horizontal adjustment to nudge labels by.
|
|
7774
|
+
nudge_y : float
|
|
7775
|
+
Vertical adjustment to nudge labels by.
|
|
7776
|
+
size_unit : {'x', 'y'}
|
|
7777
|
+
Relate the size of the text to the length of the unit step along one of the axes.
|
|
7778
|
+
If None, no fitting is performed.
|
|
7779
|
+
nudge_unit : {'identity', 'size', 'px'}, default='identity'
|
|
7780
|
+
Units for x and y nudging.
|
|
7781
|
+
Possible values:
|
|
7782
|
+
|
|
7783
|
+
- 'identity': a unit of 1 corresponds to a difference of 1 in data space;
|
|
7784
|
+
- 'size': a unit of 1 corresponds to the diameter of a point with `size=1`;
|
|
7785
|
+
- 'px': the unit is measured in screen pixels.
|
|
7786
|
+
|
|
7787
|
+
check_overlap : bool, default=False
|
|
7788
|
+
If True, skip plotting text that overlaps previous text in the same layer.
|
|
7789
|
+
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
7790
|
+
Define the color aesthetic for the geometry.
|
|
7791
|
+
seed : int
|
|
7792
|
+
Random seed used for reproducibility of label positions.
|
|
7793
|
+
max_iter : int
|
|
7794
|
+
Maximum number of iterations used to resolve label collisions.
|
|
7795
|
+
max_time : float
|
|
7796
|
+
Maximum allowed time in seconds for resolving label collisions.
|
|
7797
|
+
direction : {'both', 'x', 'y'}, default='both'
|
|
7798
|
+
Limit direction of repulsion movement.
|
|
7799
|
+
point_padding : float
|
|
7800
|
+
Padding around data points to avoid label overlap.
|
|
7801
|
+
box_padding : float
|
|
7802
|
+
Padding around text labels to avoid label-label overlap.
|
|
7803
|
+
max_overlaps : int
|
|
7804
|
+
Maximum number of overlapping labels allowed. Labels beyond this number will be hidden.
|
|
7805
|
+
min_segment_length : float
|
|
7806
|
+
Minimum length of the line segment connecting the label to the point.
|
|
7807
|
+
Shorter segments will be omitted.
|
|
7808
|
+
arrow : `FeatureSpec`
|
|
7809
|
+
Specification for arrow head, as created by `arrow()` function.
|
|
7810
|
+
other_args
|
|
7811
|
+
Other arguments passed on to the layer.
|
|
7812
|
+
These are often aesthetics settings used to set an aesthetic to a fixed value,
|
|
7813
|
+
like color='red', fill='blue', size=3 or shape=21.
|
|
7814
|
+
They may also be parameters to the paired geom/stat.
|
|
7815
|
+
|
|
7816
|
+
Returns
|
|
7817
|
+
-------
|
|
7818
|
+
`LayerSpec`
|
|
7819
|
+
Geom object specification.
|
|
7820
|
+
|
|
7821
|
+
Notes
|
|
7822
|
+
-----
|
|
7823
|
+
Adds text annotations to the plot using a force-based layout algorithm
|
|
7824
|
+
designed to prevent overlaps. Labels repel each other and the data points they annotate,
|
|
7825
|
+
resulting in a clearer and more readable visualization.
|
|
7826
|
+
|
|
7827
|
+
This is based on the "repelling labels" idea from the ggrepel package in R,
|
|
7828
|
+
and is especially useful for annotating crowded plots while minimizing collisions
|
|
7829
|
+
between text elements or label boxes.
|
|
7830
|
+
|
|
7831
|
+
`geom_text_repel()` understands the following aesthetics mappings:
|
|
7832
|
+
|
|
7833
|
+
- x : x-axis value.
|
|
7834
|
+
- y : y-axis value.
|
|
7835
|
+
- alpha : transparency level of a layer. Accept values between 0 and 1.
|
|
7836
|
+
- color (colour) : color of the geometry. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|
|
7837
|
+
- size : font size.
|
|
7838
|
+
- label : text to add to plot.
|
|
7839
|
+
- family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
7840
|
+
- fontface : font style and weight. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
7841
|
+
- hjust : horizontal text alignment relative to the x-coordinate. Possible values: 0 or 'left' - left-aligned (text starts at x), 0.5 or 'middle' (default) - text is centered on x, 1 or 'right' - right-aligned (text ends at x). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
7842
|
+
- vjust : vertical text alignment relative to the y-coordinate. Possible values: 0 or 'bottom' - bottom-aligned (bottom of text at y), 0.5 or 'center' (default) - middle of text at y, 1 or 'top' - top-aligned (top of text at y). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
7843
|
+
- angle : text rotation angle in degrees.
|
|
7844
|
+
- lineheight : line height multiplier applied to the font size in the case of multi-line text.
|
|
7845
|
+
- shape : shape of the point, an integer from 0 to 25. For more info see `Point Shapes <https://lets-plot.org/python/pages/aesthetics.html#point-shapes>`__.
|
|
7846
|
+
- point_size : A value representing the visual size of the point associated with the label.
|
|
7847
|
+
- point_stroke : Width of the point border.
|
|
7848
|
+
- segment_color : Color of the line segment connecting the label to the point.
|
|
7849
|
+
- segment_size : Width of the line segment connecting the label to the point.
|
|
7850
|
+
- segment_alpha : Transparency level of the line segment. Accept values between 0 and 1.
|
|
7851
|
+
- linetype : type of the line. Accept codes or names (0 = 'blank', 1 = 'solid', 2 = 'dashed', 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'), a hex string (up to 8 digits for dash-gap lengths), or a list pattern [offset, [dash, gap, ...]] / [dash, gap, ...]. For more info see `Line Types <https://lets-plot.org/python/pages/aesthetics.html#line-types>`__.
|
|
7852
|
+
|
|
7853
|
+
Examples
|
|
7854
|
+
--------
|
|
7855
|
+
.. jupyter-execute::
|
|
7856
|
+
:linenos:
|
|
7857
|
+
:emphasize-lines: 10
|
|
7858
|
+
|
|
7859
|
+
from lets_plot import *
|
|
7860
|
+
LetsPlot.setup_html()
|
|
7861
|
+
data = {
|
|
7862
|
+
"x": [-0.5, 0.5],
|
|
7863
|
+
"y": [0, 0],
|
|
7864
|
+
"label": ["Lorem ipsum", "dolor sit amet"]
|
|
7865
|
+
}
|
|
7866
|
+
ggplot(data, aes("x", "y")) + \\
|
|
7867
|
+
geom_point(size=20) + \\
|
|
7868
|
+
geom_text_repel(aes(label="label"), point_size=20, size=10, seed=42) + \\
|
|
7869
|
+
xlim(-1.2, 1.2) + ylim(-1.2, 1.2)
|
|
7870
|
+
|
|
7871
|
+
"""
|
|
7872
|
+
return _geom('text_repel',
|
|
7873
|
+
mapping=mapping,
|
|
7874
|
+
data=data,
|
|
7875
|
+
stat=stat,
|
|
7876
|
+
position=position,
|
|
7877
|
+
show_legend=show_legend,
|
|
7878
|
+
inherit_aes=inherit_aes,
|
|
7879
|
+
manual_key=manual_key,
|
|
7880
|
+
sampling=sampling,
|
|
7881
|
+
tooltips=tooltips,
|
|
7882
|
+
map=map, map_join=map_join, use_crs=use_crs,
|
|
7883
|
+
label_format=label_format,
|
|
7884
|
+
na_text=na_text,
|
|
7885
|
+
nudge_x=nudge_x, nudge_y=nudge_y,
|
|
7886
|
+
size_unit=size_unit,
|
|
7887
|
+
nudge_unit=nudge_unit,
|
|
7888
|
+
check_overlap=check_overlap,
|
|
7889
|
+
color_by=color_by,
|
|
7890
|
+
max_iter=max_iter,
|
|
7891
|
+
max_time=max_time,
|
|
7892
|
+
seed=seed,
|
|
7893
|
+
direction=direction,
|
|
7894
|
+
point_padding = point_padding,
|
|
7895
|
+
box_padding = box_padding,
|
|
7896
|
+
max_overlaps = max_overlaps,
|
|
7897
|
+
min_segment_length = min_segment_length,
|
|
7898
|
+
arrow=arrow,
|
|
7899
|
+
**other_args)
|
|
7900
|
+
|
|
7901
|
+
def geom_label_repel(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
7902
|
+
manual_key=None, sampling=None,
|
|
7903
|
+
tooltips=None,
|
|
7904
|
+
map=None, map_join=None, use_crs=None,
|
|
7905
|
+
label_format=None,
|
|
7906
|
+
na_text=None,
|
|
7907
|
+
nudge_x=None, nudge_y=None,
|
|
7908
|
+
label_padding=None, label_r=None, label_size=None,
|
|
7909
|
+
alpha_stroke=None,
|
|
7910
|
+
size_unit=None,
|
|
7911
|
+
nudge_unit=None,
|
|
7912
|
+
check_overlap=None,
|
|
7913
|
+
color_by=None, fill_by=None,
|
|
7914
|
+
seed=None,
|
|
7915
|
+
max_iter=None,
|
|
7916
|
+
max_time=None,
|
|
7917
|
+
direction=None,
|
|
7918
|
+
point_padding=None,
|
|
7919
|
+
box_padding=None,
|
|
7920
|
+
max_overlaps=None,
|
|
7921
|
+
min_segment_length=None,
|
|
7922
|
+
arrow=None,
|
|
7923
|
+
**other_args):
|
|
7924
|
+
|
|
7925
|
+
"""
|
|
7926
|
+
Add repelling text labels with background boxes to the plot.
|
|
7927
|
+
|
|
7928
|
+
Parameters
|
|
7929
|
+
----------
|
|
7930
|
+
mapping : `FeatureSpec`
|
|
7931
|
+
Set of aesthetic mappings created by `aes()` function.
|
|
7932
|
+
Aesthetic mappings describe the way that variables in the data are
|
|
7933
|
+
mapped to plot "aesthetics".
|
|
7934
|
+
data : dict or Pandas or Polars `DataFrame` or `GeoDataFrame`
|
|
7935
|
+
The data to be displayed in this layer. If None, the default, the data
|
|
7936
|
+
is inherited from the plot data as specified in the call to ggplot.
|
|
7937
|
+
stat : str, default='identity'
|
|
7938
|
+
The statistical transformation to use on the data for this layer, as a string.
|
|
7939
|
+
Supported transformations: 'identity' (leaves the data unchanged),
|
|
7940
|
+
'count' (counts number of points with same x-axis coordinate),
|
|
7941
|
+
'bin' (counts number of points with x-axis coordinate in the same bin),
|
|
7942
|
+
'smooth' (performs smoothing - linear default),
|
|
7943
|
+
'density' (computes and draws kernel density estimate).
|
|
7944
|
+
position : str or `FeatureSpec`, default='identity'
|
|
7945
|
+
Position adjustment.
|
|
7946
|
+
Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
7947
|
+
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
7948
|
+
show_legend : bool, default=True
|
|
7949
|
+
False - do not show legend for this layer.
|
|
7950
|
+
inherit_aes : bool, default=True
|
|
7951
|
+
False - do not combine the layer aesthetic mappings with the plot shared mappings.
|
|
7952
|
+
manual_key : str or `layer_key`
|
|
7953
|
+
The key to show in the manual legend.
|
|
7954
|
+
Specify text for the legend label or advanced settings using the `layer_key()` function.
|
|
7955
|
+
sampling : `FeatureSpec`
|
|
7956
|
+
Result of the call to the `sampling_xxx()` function.
|
|
7957
|
+
To prevent any sampling for this layer pass value "none" (string "none").
|
|
7958
|
+
tooltips : `layer_tooltips`
|
|
7959
|
+
Result of the call to the `layer_tooltips()` function.
|
|
7960
|
+
Specify appearance, style and content.
|
|
7961
|
+
Set tooltips='none' to hide tooltips from the layer.
|
|
7962
|
+
map : `GeoDataFrame` or `Geocoder`
|
|
7963
|
+
Data containing coordinates of points.
|
|
7964
|
+
map_join : str or list
|
|
7965
|
+
Keys used to join map coordinates with data.
|
|
7966
|
+
First value in pair - column/columns in `data`.
|
|
7967
|
+
Second value in pair - column/columns in `map`.
|
|
7968
|
+
use_crs : str, optional, default="EPSG:4326" (aka WGS84)
|
|
7969
|
+
EPSG code of the coordinate reference system (CRS) or the keyword "provided".
|
|
7970
|
+
If an EPSG code is given, then all the coordinates in `GeoDataFrame` (see the `map` parameter)
|
|
7971
|
+
will be projected to this CRS.
|
|
7972
|
+
Specify "provided" to disable any further re-projection and to keep the `GeoDataFrame's` original CRS.
|
|
7973
|
+
label_format : str
|
|
7974
|
+
Format used to transform label mapping values to a string.
|
|
7975
|
+
Examples:
|
|
7976
|
+
|
|
7977
|
+
- '.2f' -> '12.45'
|
|
7978
|
+
- 'Num {}' -> 'Num 12.456789'
|
|
7979
|
+
- 'TTL: {.2f}$' -> 'TTL: 12.45$'
|
|
7980
|
+
|
|
7981
|
+
For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
|
|
7982
|
+
nudge_x : float
|
|
7983
|
+
Horizontal adjustment to nudge labels by.
|
|
7984
|
+
nudge_y : float
|
|
7985
|
+
Vertical adjustment to nudge labels by.
|
|
7986
|
+
na_text : str, default='n/a'
|
|
7987
|
+
Text to show for missing values.
|
|
7988
|
+
label_padding : float
|
|
7989
|
+
Amount of padding around label. Default is 0.25 of font size.
|
|
7990
|
+
label_r : float
|
|
7991
|
+
Radius of rounded corners. Default is 0.15 of label height.
|
|
7992
|
+
label_size : float, default = 1.0
|
|
7993
|
+
Size of label border.
|
|
7994
|
+
alpha_stroke : bool, default=False
|
|
7995
|
+
Enable the applying of 'alpha' to 'color' (label text and border).
|
|
7996
|
+
size_unit : {'x', 'y'}
|
|
7997
|
+
Relate the size of the text label to the length of the unit step along one of the axes.
|
|
7998
|
+
If None, no fitting is performed.
|
|
7999
|
+
nudge_unit : {'identity', 'size', 'px'}, default='identity'
|
|
8000
|
+
Units for x and y nudging.
|
|
8001
|
+
Possible values:
|
|
8002
|
+
|
|
8003
|
+
- 'identity': a unit of 1 corresponds to a difference of 1 in data space;
|
|
8004
|
+
- 'size': a unit of 1 corresponds to the diameter of a point with `size=1`;
|
|
8005
|
+
- 'px': the unit is measured in screen pixels.
|
|
8006
|
+
|
|
8007
|
+
check_overlap : bool, default=False
|
|
8008
|
+
If True, skip plotting text that overlaps previous text in the same layer.
|
|
8009
|
+
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
8010
|
+
Define the color aesthetic for the geometry.
|
|
8011
|
+
fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
|
|
8012
|
+
Define the fill aesthetic for the geometry.
|
|
8013
|
+
seed : int
|
|
8014
|
+
Random seed for reproducibility.
|
|
8015
|
+
max_iter : int
|
|
8016
|
+
Maximum number of iterations for the repulsion algorithm.
|
|
8017
|
+
max_time : float
|
|
8018
|
+
Maximum allowed time in seconds for resolving label collisions.
|
|
8019
|
+
direction : {'both', 'x', 'y'}, default='both'
|
|
8020
|
+
Direction in which labels can be moved.
|
|
8021
|
+
point_padding : float
|
|
8022
|
+
Padding around the data point.
|
|
8023
|
+
box_padding : float
|
|
8024
|
+
Padding around the label box.
|
|
8025
|
+
max_overlaps : int
|
|
8026
|
+
Max number of overlapping labels to allow.
|
|
8027
|
+
min_segment_length : float
|
|
8028
|
+
Minimum length of the connecting line segment. Shorter ones are omitted.
|
|
8029
|
+
arrow : `FeatureSpec`
|
|
8030
|
+
Specification for arrow head, as created by `arrow()` function.
|
|
8031
|
+
other_args
|
|
8032
|
+
Other arguments passed on to the layer.
|
|
8033
|
+
These are often aesthetics settings used to set an aesthetic to a fixed value,
|
|
8034
|
+
like color='red', fill='blue', size=3 or shape=21.
|
|
8035
|
+
They may also be parameters to the paired geom/stat.
|
|
8036
|
+
|
|
8037
|
+
Returns
|
|
8038
|
+
-------
|
|
8039
|
+
`LayerSpec`
|
|
8040
|
+
Geom object specification.
|
|
8041
|
+
|
|
8042
|
+
Notes
|
|
8043
|
+
-----
|
|
8044
|
+
Adds label annotations to the plot using a force-based layout algorithm
|
|
8045
|
+
designed to prevent overlaps. Labels repel each other and the data points they annotate,
|
|
8046
|
+
resulting in a clearer and more readable visualization.
|
|
8047
|
+
|
|
8048
|
+
This is based on the "repelling labels" idea from the ggrepel package in R,
|
|
8049
|
+
and is especially useful for annotating crowded plots while minimizing collisions
|
|
8050
|
+
between text elements or label boxes.
|
|
8051
|
+
|
|
8052
|
+
`geom_label_repel()` understands the following aesthetics mappings:
|
|
8053
|
+
|
|
8054
|
+
- x : x-axis value.
|
|
8055
|
+
- y : y-axis value.
|
|
8056
|
+
- alpha : transparency level of a layer. Accept values between 0 and 1.
|
|
8057
|
+
- color (colour) : color of the geometry. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
|
|
8058
|
+
- fill: background color of the label.
|
|
8059
|
+
- size : font size.
|
|
8060
|
+
- label : text to add to plot.
|
|
8061
|
+
- family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
8062
|
+
- fontface : font style and weight. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
|
|
8063
|
+
- hjust : horizontal text alignment relative to the x-coordinate. Possible values: 0 or 'left' - left-aligned (text starts at x), 0.5 or 'middle' (default) - text is centered on x, 1 or 'right' - right-aligned (text ends at x). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
8064
|
+
- vjust : vertical text alignment relative to the y-coordinate. Possible values: 0 or 'bottom' - bottom-aligned (bottom of text at y), 0.5 or 'center' (default) - middle of text at y, 1 or 'top' - top-aligned (top of text at y). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
|
|
8065
|
+
- angle : rotation angle in degrees.
|
|
8066
|
+
- lineheight : line height multiplier applied to the font size in the case of multi-line text.
|
|
8067
|
+
- shape : shape of the point, an integer from 0 to 25. For more info see `Point Shapes <https://lets-plot.org/python/pages/aesthetics.html#point-shapes>`__.
|
|
8068
|
+
- point_size : A value representing the visual size of the point associated with the label.
|
|
8069
|
+
- point_stroke : Width of the point border.
|
|
8070
|
+
- segment_color : Color of the line segment connecting the label to the point.
|
|
8071
|
+
- segment_size : Width of the line segment connecting the label to the point.
|
|
8072
|
+
- segment_alpha : Transparency level of the line segment. Accept values between 0 and 1.
|
|
8073
|
+
- linetype : type of the line. Accept codes or names (0 = 'blank', 1 = 'solid', 2 = 'dashed', 3 = 'dotted', 4 = 'dotdash', 5 = 'longdash', 6 = 'twodash'), a hex string (up to 8 digits for dash-gap lengths), or a list pattern [offset, [dash, gap, ...]] / [dash, gap, ...]. For more info see `Line Types <https://lets-plot.org/python/pages/aesthetics.html#line-types>`__.
|
|
8074
|
+
|
|
8075
|
+
Examples
|
|
8076
|
+
--------
|
|
8077
|
+
.. jupyter-execute::
|
|
8078
|
+
:linenos:
|
|
8079
|
+
:emphasize-lines: 10
|
|
8080
|
+
|
|
8081
|
+
from lets_plot import *
|
|
8082
|
+
LetsPlot.setup_html()
|
|
8083
|
+
data = {
|
|
8084
|
+
"x": [-0.5, 0.5],
|
|
8085
|
+
"y": [0, 0],
|
|
8086
|
+
"label": ["Lorem ipsum", "dolor sit amet"]
|
|
8087
|
+
}
|
|
8088
|
+
ggplot(data, aes("x", "y")) + \\
|
|
8089
|
+
geom_point(size=20) + \\
|
|
8090
|
+
geom_label_repel(aes(label="label"), point_size=20, size=10, seed=42) + \\
|
|
8091
|
+
xlim(-1.2, 1.2) + ylim(-1.2, 1.2)
|
|
8092
|
+
|
|
8093
|
+
"""
|
|
8094
|
+
|
|
8095
|
+
return _geom('label_repel',
|
|
8096
|
+
mapping=mapping,
|
|
8097
|
+
data=data,
|
|
8098
|
+
stat=stat,
|
|
8099
|
+
position=position,
|
|
8100
|
+
show_legend=show_legend,
|
|
8101
|
+
inherit_aes=inherit_aes,
|
|
8102
|
+
manual_key=manual_key,
|
|
8103
|
+
sampling=sampling,
|
|
8104
|
+
tooltips=tooltips,
|
|
8105
|
+
map=map, map_join=map_join, use_crs=use_crs,
|
|
8106
|
+
label_format=label_format,
|
|
8107
|
+
na_text=na_text,
|
|
8108
|
+
nudge_x=nudge_x, nudge_y=nudge_y,
|
|
8109
|
+
label_padding=label_padding,
|
|
8110
|
+
label_r=label_r,
|
|
8111
|
+
label_size=label_size,
|
|
8112
|
+
alpha_stroke=alpha_stroke,
|
|
8113
|
+
size_unit=size_unit,
|
|
8114
|
+
nudge_unit=nudge_unit,
|
|
8115
|
+
check_overlap=check_overlap,
|
|
8116
|
+
color_by=color_by, fill_by=fill_by,
|
|
8117
|
+
max_iter=max_iter,
|
|
8118
|
+
max_time=max_time,
|
|
8119
|
+
seed=seed,
|
|
8120
|
+
direction=direction,
|
|
8121
|
+
point_padding = point_padding,
|
|
8122
|
+
box_padding = box_padding,
|
|
8123
|
+
max_overlaps = max_overlaps,
|
|
8124
|
+
min_segment_length = min_segment_length,
|
|
8125
|
+
arrow=arrow,
|
|
8126
|
+
**other_args)
|
|
8127
|
+
|
|
8128
|
+
|
|
8129
|
+
def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
8130
|
+
manual_key=None, sampling=None,
|
|
8131
|
+
tooltips=None, labels=None,
|
|
8132
|
+
map=None, map_join=None, use_crs=None,
|
|
8133
|
+
hole=None,
|
|
8134
|
+
stroke_side=None,
|
|
8135
|
+
spacer_width=None, spacer_color=None,
|
|
8136
|
+
start=None, direction=None,
|
|
8137
|
+
size_unit=None,
|
|
8138
|
+
color_by=None, fill_by=None,
|
|
8139
|
+
**other_args):
|
|
8140
|
+
"""
|
|
8141
|
+
Draw pie chart.
|
|
8142
|
+
|
|
8143
|
+
Parameters
|
|
8144
|
+
----------
|
|
8145
|
+
mapping : `FeatureSpec`
|
|
8146
|
+
Set of aesthetic mappings created by `aes()` function.
|
|
8147
|
+
Aesthetic mappings describe the way that variables in the data are
|
|
8148
|
+
mapped to plot "aesthetics".
|
|
8149
|
+
data : dict or Pandas or Polars `DataFrame` or `GeoDataFrame`
|
|
8150
|
+
The data to be displayed in this layer. If None, the default, the data
|
|
8151
|
+
is inherited from the plot data as specified in the call to ggplot.
|
|
8152
|
+
stat : str, default='count2d'
|
|
8153
|
+
The statistical transformation to use on the data for this layer, as a string.
|
|
8154
|
+
Supported transformations: 'identity' (leaves the data unchanged),
|
|
8155
|
+
'count2d' (counts number of points with same x,y coordinate).
|
|
8156
|
+
position : str or `FeatureSpec`, default='identity'
|
|
8157
|
+
Position adjustment.
|
|
8158
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
8159
|
+
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
8160
|
+
show_legend : bool, default=True
|
|
8161
|
+
False - do not show legend for this layer.
|
|
8162
|
+
inherit_aes : bool, default=True
|
|
8163
|
+
False - do not combine the layer aesthetic mappings with the plot shared mappings.
|
|
8164
|
+
manual_key : str or `layer_key`
|
|
8165
|
+
The key to show in the manual legend.
|
|
8166
|
+
Specify text for the legend label or advanced settings using the `layer_key()` function.
|
|
8167
|
+
sampling : `FeatureSpec`
|
|
8168
|
+
Result of the call to the `sampling_xxx()` function.
|
|
8169
|
+
To prevent any sampling for this layer pass value "none" (string "none").
|
|
8170
|
+
tooltips : `layer_tooltips`
|
|
8171
|
+
Result of the call to the `layer_tooltips()` function.
|
|
8172
|
+
Specify appearance, style and content.
|
|
8173
|
+
Set tooltips='none' to hide tooltips from the layer.
|
|
8174
|
+
labels : `layer_labels`
|
|
8175
|
+
Result of the call to the `layer_labels()` function.
|
|
8176
|
+
Specify style and content of the annotations.
|
|
8177
|
+
map : `GeoDataFrame` or `Geocoder`
|
|
8178
|
+
Data containing coordinates of points.
|
|
8179
|
+
map_join : str or list
|
|
8180
|
+
Keys used to join map coordinates with data.
|
|
8181
|
+
First value in pair - column/columns in `data`.
|
|
8182
|
+
Second value in pair - column/columns in `map`.
|
|
8183
|
+
use_crs : str, optional, default="EPSG:4326" (aka WGS84)
|
|
8184
|
+
EPSG code of the coordinate reference system (CRS) or the keyword "provided".
|
|
8185
|
+
If an EPSG code is given, then all the coordinates in `GeoDataFrame` (see the `map` parameter)
|
|
8186
|
+
will be projected to this CRS.
|
|
8187
|
+
Specify "provided" to disable any further re-projection and to keep the `GeoDataFrame's` original CRS.
|
|
8188
|
+
hole : float, default=0.0
|
|
8189
|
+
A multiplicative factor applied to the pie diameter to draw donut-like chart.
|
|
8190
|
+
Accept values between 0 and 1.
|
|
8191
|
+
stroke_side : {'outer', 'inner', 'both'}, default='both'
|
|
8192
|
+
Define which arcs of pie sector should have a stroke.
|
|
8193
|
+
spacer_width : float, default=0.75
|
|
8194
|
+
Line width between sectors in pixels.
|
|
7554
8195
|
Spacers are not applied to exploded sectors and to sides of adjacent sectors.
|
|
7555
8196
|
spacer_color : str
|
|
7556
8197
|
Color for spacers between sectors. By default, the "paper" color is used.
|
|
@@ -7771,7 +8412,7 @@ def geom_lollipop(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
7771
8412
|
'density' (computes and draws kernel density estimate).
|
|
7772
8413
|
position : str or `FeatureSpec`, default='identity'
|
|
7773
8414
|
Position adjustment.
|
|
7774
|
-
Either a position adjustment name: 'dodge', '
|
|
8415
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
7775
8416
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
7776
8417
|
show_legend : bool, default=True
|
|
7777
8418
|
False - do not show legend for this layer.
|
|
@@ -7927,7 +8568,7 @@ def geom_count(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
7927
8568
|
The statistical transformation to use on the data for this layer, as a string.
|
|
7928
8569
|
position : str or `FeatureSpec`, default='identity'
|
|
7929
8570
|
Position adjustment.
|
|
7930
|
-
Either a position adjustment name: 'dodge', '
|
|
8571
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
7931
8572
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
7932
8573
|
show_legend : bool, default=True
|
|
7933
8574
|
False - do not show legend for this layer.
|
|
@@ -8059,7 +8700,7 @@ def geom_blank(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
8059
8700
|
'sum' (counts the number of points at each location - might help to workaround overplotting).
|
|
8060
8701
|
position : str or `FeatureSpec`, default='identity'
|
|
8061
8702
|
Position adjustment.
|
|
8062
|
-
Either a position adjustment name: 'dodge', '
|
|
8703
|
+
Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
|
|
8063
8704
|
'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
|
|
8064
8705
|
show_legend : bool, default=True
|
|
8065
8706
|
False - do not show legend for this layer.
|