lets-plot 4.6.2__cp311-cp311-macosx_11_0_arm64.whl → 4.7.0__cp311-cp311-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lets-plot might be problematic. Click here for more details.

lets_plot/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', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
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.
@@ -87,8 +87,11 @@ def geom_point(mapping=None, *, data=None, stat=None, position=None, show_legend
87
87
  If an EPSG code is given, then all the coordinates in `GeoDataFrame` (see the `map` parameter)
88
88
  will be projected to this CRS.
89
89
  Specify "provided" to disable any further re-projection and to keep the `GeoDataFrame's` original CRS.
90
- size_unit : {'x', 'y'}
90
+ size_unit : {'x', 'y', 'min', 'max'}
91
91
  Relate the size of the point to the length of the unit step along one of the axes.
92
+ 'x' uses the unit step along the x-axis, 'y' uses the unit step along the y-axis.
93
+ 'min' uses the smaller of the unit steps along x and y axes.
94
+ 'max' uses the larger of the unit steps along x and y axes.
92
95
  If None, no fitting is performed.
93
96
  color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
94
97
  Define the color aesthetic for the geometry.
@@ -253,7 +256,7 @@ def geom_path(mapping=None, *, data=None, stat=None, position=None, show_legend=
253
256
  'density' (computes and draws kernel density estimate).
254
257
  position : str or `FeatureSpec`, default='identity'
255
258
  Position adjustment.
256
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
259
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
257
260
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
258
261
  show_legend : bool, default=True
259
262
  False - do not show legend for this layer.
@@ -441,7 +444,7 @@ def geom_line(mapping=None, *, data=None, stat=None, position=None, show_legend=
441
444
  'density' (computes and draws kernel density estimate).
442
445
  position : str or `FeatureSpec`, default='identity'
443
446
  Position adjustment.
444
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
447
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
445
448
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
446
449
  show_legend : bool, default=True
447
450
  False - do not show legend for this layer.
@@ -572,7 +575,7 @@ def geom_smooth(mapping=None, *, data=None, stat=None, position=None, show_legen
572
575
  'density' (computes and draws kernel density estimate).
573
576
  position : str or `FeatureSpec`, default='identity'
574
577
  Position adjustment.
575
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
578
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
576
579
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
577
580
  show_legend : bool, default=True
578
581
  False - do not show legend for this layer.
@@ -758,7 +761,7 @@ def geom_bar(mapping=None, *, data=None, stat=None, position=None, show_legend=N
758
761
  'density' (computes and draws kernel density estimate).
759
762
  position : str or `FeatureSpec`, default='stack'
760
763
  Position adjustment.
761
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
764
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
762
765
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
763
766
  show_legend : bool, default=True
764
767
  False - do not show legend for this layer.
@@ -926,7 +929,7 @@ def geom_histogram(mapping=None, *, data=None, stat=None, position=None, show_le
926
929
  'density' (computes and draws kernel density estimate).
927
930
  position : str or `FeatureSpec`, default='stack'
928
931
  Position adjustment.
929
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
932
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
930
933
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
931
934
  show_legend : bool, default=True
932
935
  False - do not show legend for this layer.
@@ -1266,7 +1269,7 @@ def geom_bin2d(mapping=None, *, data=None, stat=None, position=None, show_legend
1266
1269
  The statistical transformation to use on the data for this layer, as a string.
1267
1270
  position : str or `FeatureSpec`, default='identity'
1268
1271
  Position adjustment.
1269
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
1272
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
1270
1273
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
1271
1274
  show_legend : bool, default=True
1272
1275
  False - do not show legend for this layer.
@@ -1443,7 +1446,7 @@ def geom_hex(mapping=None, *, data=None, stat=None, position=None, show_legend=N
1443
1446
  The statistical transformation to use on the data for this layer, as a string.
1444
1447
  position : str or `FeatureSpec`, default='identity'
1445
1448
  Position adjustment.
1446
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
1449
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
1447
1450
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
1448
1451
  show_legend : bool, default=True
1449
1452
  False - do not show legend for this layer.
@@ -1637,7 +1640,7 @@ def geom_tile(mapping=None, *, data=None, stat=None, position=None, show_legend=
1637
1640
  The statistical transformation to use on the data for this layer, as a string.
1638
1641
  position : str or `FeatureSpec`, default='identity'
1639
1642
  Position adjustment.
1640
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
1643
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
1641
1644
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
1642
1645
  show_legend : bool, default=True
1643
1646
  False - do not show legend for this layer.
@@ -1810,7 +1813,7 @@ def geom_raster(mapping=None, *, data=None, stat=None, position=None, show_legen
1810
1813
  The statistical transformation to use on the data for this layer, as a string.
1811
1814
  position : str or `FeatureSpec`, default='identity'
1812
1815
  Position adjustment.
1813
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
1816
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
1814
1817
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
1815
1818
  show_legend : bool, default=True
1816
1819
  False - do not show legend for this layer.
@@ -1910,7 +1913,7 @@ def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_leg
1910
1913
  'density' (computes and draws kernel density estimate).
1911
1914
  position : str or `FeatureSpec`, default='identity'
1912
1915
  Position adjustment.
1913
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
1916
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
1914
1917
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
1915
1918
  show_legend : bool, default=True
1916
1919
  False - do not show legend for this layer.
@@ -2055,7 +2058,8 @@ def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_leg
2055
2058
 
2056
2059
 
2057
2060
  def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
2058
- manual_key=None, sampling=None, tooltips=None,
2061
+ manual_key=None, sampling=None,
2062
+ tooltips=None, labels=None,
2059
2063
  fatten=None,
2060
2064
  width_unit=None,
2061
2065
  color_by=None, fill_by=None,
@@ -2079,9 +2083,9 @@ def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_leg
2079
2083
  'bin' (counts number of points with x-axis coordinate in the same bin),
2080
2084
  'smooth' (performs smoothing - linear default),
2081
2085
  'density' (computes and draws kernel density estimate).
2082
- position : str or `FeatureSpec`, default='dodge'
2086
+ position : str or `FeatureSpec`, default=position_dodge(width=.95)
2083
2087
  Position adjustment.
2084
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
2088
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
2085
2089
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
2086
2090
  show_legend : bool, default=True
2087
2091
  False - do not show legend for this layer.
@@ -2203,6 +2207,7 @@ def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_leg
2203
2207
  manual_key=manual_key,
2204
2208
  sampling=sampling,
2205
2209
  tooltips=tooltips,
2210
+ labels=labels,
2206
2211
  fatten=fatten,
2207
2212
  width_unit=width_unit,
2208
2213
  color_by=color_by, fill_by=fill_by,
@@ -2235,7 +2240,7 @@ def geom_pointrange(mapping=None, *, data=None, stat=None, position=None, show_l
2235
2240
  'density' (computes and draws kernel density estimate).
2236
2241
  position : str or `FeatureSpec`, default='identity'
2237
2242
  Position adjustment.
2238
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
2243
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
2239
2244
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
2240
2245
  show_legend : bool, default=True
2241
2246
  False - do not show legend for this layer.
@@ -2376,7 +2381,7 @@ def geom_linerange(mapping=None, *, data=None, stat=None, position=None, show_le
2376
2381
  'density' (computes and draws kernel density estimate).
2377
2382
  position : str or `FeatureSpec`, default='identity'
2378
2383
  Position adjustment.
2379
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
2384
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
2380
2385
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
2381
2386
  show_legend : bool, default=True
2382
2387
  False - do not show legend for this layer.
@@ -2503,7 +2508,7 @@ def geom_contour(mapping=None, *, data=None, stat=None, position=None, show_lege
2503
2508
  The statistical transformation to use on the data for this layer, as a string.
2504
2509
  position : str or `FeatureSpec`, default='identity'
2505
2510
  Position adjustment.
2506
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
2511
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
2507
2512
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
2508
2513
  show_legend : bool, default=True
2509
2514
  False - do not show legend for this layer.
@@ -2657,7 +2662,7 @@ def geom_contourf(mapping=None, *, data=None, stat=None, position=None, show_leg
2657
2662
  The statistical transformation to use on the data for this layer, as a string.
2658
2663
  position : str or `FeatureSpec`, default='identity'
2659
2664
  Position adjustment.
2660
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
2665
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
2661
2666
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
2662
2667
  show_legend : bool, default=True
2663
2668
  False - do not show legend for this layer.
@@ -2807,7 +2812,7 @@ def geom_polygon(mapping=None, *, data=None, stat=None, position=None, show_lege
2807
2812
  The statistical transformation to use on the data for this layer, as a string.
2808
2813
  position : str or `FeatureSpec`, default='identity'
2809
2814
  Position adjustment.
2810
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
2815
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
2811
2816
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
2812
2817
  show_legend : bool, default=True
2813
2818
  False - do not show legend for this layer.
@@ -2998,7 +3003,7 @@ def geom_map(mapping=None, *, data=None, stat=None, position=None, show_legend=N
2998
3003
  'density' (computes and draws kernel density estimate).
2999
3004
  position : str or `FeatureSpec`, default='identity'
3000
3005
  Position adjustment.
3001
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
3006
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
3002
3007
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
3003
3008
  show_legend : bool, default=True
3004
3009
  False - do not show legend for this layer.
@@ -3170,7 +3175,7 @@ def geom_abline(mapping=None, *, data=None, stat=None, position=None, show_legen
3170
3175
  The statistical transformation to use on the data for this layer, as a string.
3171
3176
  position : str or `FeatureSpec`, default='identity'
3172
3177
  Position adjustment.
3173
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
3178
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
3174
3179
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
3175
3180
  show_legend : bool, default=True
3176
3181
  False - do not show legend for this layer.
@@ -3285,7 +3290,7 @@ def geom_band(mapping=None, *, data=None, stat=None, position=None, show_legend=
3285
3290
  The statistical transformation to use on the data for this layer, as a string.
3286
3291
  position : str or `FeatureSpec`, default='identity'
3287
3292
  Position adjustment.
3288
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
3293
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
3289
3294
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
3290
3295
  show_legend : bool, default=True
3291
3296
  False - do not show legend for this layer.
@@ -3399,7 +3404,7 @@ def geom_hline(mapping=None, *, data=None, stat=None, position=None, show_legend
3399
3404
  The statistical transformation to use on the data for this layer, as a string.
3400
3405
  position : str or `FeatureSpec`, default='identity'
3401
3406
  Position adjustment.
3402
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
3407
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
3403
3408
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
3404
3409
  show_legend : bool, default=True
3405
3410
  False - do not show legend for this layer.
@@ -3524,7 +3529,7 @@ def geom_vline(mapping=None, *, data=None, stat=None, position=None, show_legend
3524
3529
  The statistical transformation to use on the data for this layer, as a string.
3525
3530
  position : str or `FeatureSpec`, default='identity'
3526
3531
  Position adjustment.
3527
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
3532
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
3528
3533
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
3529
3534
  show_legend : bool, default=True
3530
3535
  False - do not show legend for this layer.
@@ -3654,9 +3659,9 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
3654
3659
  is inherited from the plot data as specified in the call to ggplot.
3655
3660
  stat : str, default='boxplot'
3656
3661
  The statistical transformation to use on the data for this layer, as a string.
3657
- position : str or `FeatureSpec`, default='dodge'
3662
+ position : str or `FeatureSpec`, default=position_dodge(width=.95)
3658
3663
  Position adjustment.
3659
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
3664
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
3660
3665
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
3661
3666
  show_legend : bool, default=True
3662
3667
  False - do not show legend for this layer.
@@ -3729,12 +3734,12 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
3729
3734
 
3730
3735
  `geom_boxplot()` understands the following aesthetics mappings:
3731
3736
 
3732
- - x : x-axis coordinates.
3733
- - lower : lower hinge.
3734
- - middle : median.
3735
- - upper : upper hinge.
3736
- - ymin : lower whisker.
3737
- - ymax : upper whisker.
3737
+ - x or y: x-axis or y-axis coordinates for vertical or horizontal boxplot, respectively.
3738
+ - lower or xlower : lower hinge.
3739
+ - middle or xmiddle : median.
3740
+ - upper or xupper : upper hinge.
3741
+ - ymin or xmin : lower whisker.
3742
+ - ymax or xmax : upper whisker.
3738
3743
  - alpha : transparency level of a layer. Accept values between 0 and 1.
3739
3744
  - 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
3745
  - fill : fill color. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
@@ -3890,9 +3895,9 @@ def geom_violin(mapping=None, *, data=None, stat=None, position=None, show_legen
3890
3895
  is inherited from the plot data as specified in the call to ggplot.
3891
3896
  stat : str, default='ydensity'
3892
3897
  The statistical transformation to use on the data for this layer, as a string.
3893
- position : str or `FeatureSpec`, default='dodge'
3898
+ position : str or `FeatureSpec`, default=position_dodge(width=.95)
3894
3899
  Position adjustment.
3895
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
3900
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
3896
3901
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
3897
3902
  show_legend : bool, default=True
3898
3903
  False - do not show legend for this layer.
@@ -3917,7 +3922,7 @@ def geom_violin(mapping=None, *, data=None, stat=None, position=None, show_legen
3917
3922
  If 1, another half is drawn.
3918
3923
  If 0, violins look as usual.
3919
3924
  quantiles : list of float, default=[0.25, 0.5, 0.75]
3920
- Draw horizontal lines at the given quantiles of the density estimate.
3925
+ A list of quantiles to be calculated and written to the `..quantile..` variable.
3921
3926
  quantile_lines : bool, default=False
3922
3927
  Show the quantile lines.
3923
3928
  scale : {'area', 'count', 'width'}, default='area'
@@ -4098,6 +4103,209 @@ def geom_violin(mapping=None, *, data=None, stat=None, position=None, show_legen
4098
4103
  **other_args)
4099
4104
 
4100
4105
 
4106
+ def geom_sina(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
4107
+ manual_key=None, sampling=None,
4108
+ tooltips=None,
4109
+ orientation=None,
4110
+ seed=None,
4111
+ show_half=None,
4112
+ quantiles=None,
4113
+ scale=None, trim=None, tails_cutoff=None, kernel=None, bw=None, adjust=None, n=None, fs_max=None,
4114
+ color_by=None, fill_by=None,
4115
+ **other_args):
4116
+ """
4117
+ A sina plot visualizes a single variable across classes, with jitter width reflecting the data density in each class.
4118
+
4119
+ Parameters
4120
+ ----------
4121
+ mapping : `FeatureSpec`
4122
+ Set of aesthetic mappings created by `aes()` function.
4123
+ Aesthetic mappings describe the way that variables in the data are
4124
+ mapped to plot "aesthetics".
4125
+ data : dict or Pandas or Polars `DataFrame`
4126
+ The data to be displayed in this layer. If None, the default, the data
4127
+ is inherited from the plot data as specified in the call to ggplot.
4128
+ stat : str, default='sina'
4129
+ The statistical transformation to use on the data for this layer, as a string.
4130
+ position : str or `FeatureSpec`, default=position_dodge(width=.95)
4131
+ Position adjustment.
4132
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
4133
+ 'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
4134
+ show_legend : bool, default=True
4135
+ False - do not show legend for this layer.
4136
+ inherit_aes : bool, default=True
4137
+ False - do not combine the layer aesthetic mappings with the plot shared mappings.
4138
+ manual_key : str or `layer_key`
4139
+ The key to show in the manual legend.
4140
+ Specify text for the legend label or advanced settings using the `layer_key()` function.
4141
+ sampling : `FeatureSpec`
4142
+ Result of the call to the `sampling_xxx()` function.
4143
+ To prevent any sampling for this layer pass value "none" (string "none").
4144
+ tooltips : `layer_tooltips`
4145
+ Result of the call to the `layer_tooltips()` function.
4146
+ Specify appearance, style and content.
4147
+ Set tooltips='none' to hide tooltips from the layer.
4148
+ orientation : str
4149
+ Specify the axis that the layer's stat and geom should run along.
4150
+ The default value (None) automatically determines the orientation based on the aesthetic mapping.
4151
+ If the automatic detection doesn't work, it can be set explicitly by specifying the 'x' or 'y' orientation.
4152
+ seed : int
4153
+ A random seed to make the jitter reproducible.
4154
+ If None (the default value), the seed is initialised with a random value.
4155
+ show_half : float, default=0
4156
+ If -1, only half of each group is drawn.
4157
+ If 1, another half is drawn.
4158
+ If 0, sina look as usual.
4159
+ quantiles : list of float, default=[0.25, 0.5, 0.75]
4160
+ A list of quantiles to be calculated and written to the `..quantile..` variable.
4161
+ scale : {'area', 'count', 'width'}, default='area'
4162
+ If 'area', all groups have the same area.
4163
+ If 'count', areas are scaled proportionally to the number of observations.
4164
+ If 'width', all groups have the same maximum width.
4165
+ trim : bool, default=True
4166
+ Trim the tails of the violins, which limit the area for sina points, to the range of the data.
4167
+ tails_cutoff : float, default=3.0
4168
+ Extend domain of each violin, which limit the area for sina points, on `tails_cutoff * bw` if `trim=False`.
4169
+ kernel : str, default='gaussian'
4170
+ The kernel we use to calculate the density function.
4171
+ Choose among 'gaussian', 'cosine', 'optcosine', 'rectangular' (or 'uniform'),
4172
+ 'triangular', 'biweight' (or 'quartic'), 'epanechikov' (or 'parabolic').
4173
+ bw : str or float
4174
+ The method (or exact value) of bandwidth.
4175
+ Either a string (choose among 'nrd0' and 'nrd'), or a float.
4176
+ adjust : float
4177
+ Adjust the value of bandwidth by multiplying it. Change how smooth the frequency curve is.
4178
+ n : int, default=512
4179
+ The number of sampled points for plotting the function, that limit the area for sina points.
4180
+ fs_max : int, default=500
4181
+ Maximum size of data to use density computation with 'full scan'.
4182
+ For bigger data, less accurate but more efficient density computation is applied.
4183
+ color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
4184
+ Define the color aesthetic for the geometry.
4185
+ fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
4186
+ Define the fill aesthetic for the geometry.
4187
+ other_args
4188
+ Other arguments passed on to the layer.
4189
+ These are often aesthetics settings used to set an aesthetic to a fixed value,
4190
+ like color='red', fill='blue', size=3 or shape=21.
4191
+ They may also be parameters to the paired geom/stat.
4192
+
4193
+ Returns
4194
+ -------
4195
+ `LayerSpec`
4196
+ Geom object specification.
4197
+
4198
+ Notes
4199
+ -----
4200
+ Computed variables:
4201
+
4202
+ - ..violinwidth.. : density scaled for the sina plot, according to area, counts or to a constant maximum width (mapped by default).
4203
+ - ..density.. : density estimate.
4204
+ - ..count.. : density * number of points.
4205
+ - ..scaled.. : density estimate, scaled to maximum of 1.
4206
+ - ..quantile.. : quantile estimate.
4207
+
4208
+ `geom_sina()` understands the following aesthetics mappings:
4209
+
4210
+ - x : x-axis value.
4211
+ - y : y-axis value.
4212
+ - alpha : transparency level of a point. Accept values between 0 and 1.
4213
+ - color (colour) : color of the geometry. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
4214
+ - 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>`__.
4215
+ - 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>`__.
4216
+ - size : size of the point.
4217
+ - stroke : width of the shape border. Applied only to the shapes having border.
4218
+ - weight : used by 'sina' stat to compute weighted density.
4219
+ - quantile : quantile values.
4220
+ - width : maximal width of sina plot. Typically ranges between 0 and 1. Values that are greater than 1 lead to overlapping of the geometries.
4221
+
4222
+ ----
4223
+
4224
+ To hide axis tooltips, set 'blank' or the result of `element_blank()`
4225
+ to the `axis_tooltip`, `axis_tooltip_x` or `axis_tooltip_y` parameter of the `theme()`.
4226
+
4227
+ Examples
4228
+ --------
4229
+ .. jupyter-execute::
4230
+ :linenos:
4231
+ :emphasize-lines: 10
4232
+
4233
+ import numpy as np
4234
+ from lets_plot import *
4235
+ LetsPlot.setup_html()
4236
+ n = 100
4237
+ np.random.seed(42)
4238
+ x = np.random.choice(['a', 'b', 'c'], size=n)
4239
+ y = np.random.randint(10, size=n)
4240
+ ggplot({'x': x, 'y': y}, aes(x='x', y='y')) + \\
4241
+ geom_violin() + \\
4242
+ geom_sina(seed=42)
4243
+
4244
+ |
4245
+
4246
+ .. jupyter-execute::
4247
+ :linenos:
4248
+ :emphasize-lines: 12
4249
+
4250
+ import numpy as np
4251
+ from lets_plot import *
4252
+ LetsPlot.setup_html()
4253
+ n = 100
4254
+ np.random.seed(42)
4255
+ x = np.random.choice(['a', 'b', 'b', 'c'], size=n)
4256
+ y = np.random.normal(size=n)
4257
+ quantiles = [.02, .25, .5, .75, .98]
4258
+ ggplot({'x': x, 'y': y}, aes('x', 'y')) + \\
4259
+ geom_violin(aes(fill='..quantile..'), scale='count', alpha=.5, \\
4260
+ quantiles=quantiles, quantile_lines=True) + \\
4261
+ geom_sina(aes(color='..quantile..'), scale='count', quantiles=quantiles, seed=42) + \\
4262
+ scale_continuous(['color', 'fill'], low="black", high="#6baed6")
4263
+
4264
+ |
4265
+
4266
+ .. jupyter-execute::
4267
+ :linenos:
4268
+ :emphasize-lines: 14-17
4269
+
4270
+ import numpy as np
4271
+ from lets_plot import *
4272
+ LetsPlot.setup_html()
4273
+ n = 100
4274
+ np.random.seed(42)
4275
+ x = np.random.choice(["a", "b", "c", "d"], size=n)
4276
+ y1 = np.random.normal(size=n)
4277
+ y2 = np.random.normal(size=n)
4278
+ ggplot({'x': x, 'y1': y1, 'y2': y2}) + \\
4279
+ geom_violin(aes('x', 'y1'), show_half=-1, \\
4280
+ trim=False, fill='#ffffb2') + \\
4281
+ geom_violin(aes('x', 'y2'), show_half=1, \\
4282
+ trim=False, fill='#74c476') + \\
4283
+ geom_sina(aes('x', 'y1'), show_half=-1, \\
4284
+ fill='#ffffb2', shape=24, size=2, seed=42) + \\
4285
+ geom_sina(aes('x', 'y2'), show_half=1, \\
4286
+ fill='#74c476', shape=25, size=2, seed=42)
4287
+
4288
+ """
4289
+ return _geom('sina',
4290
+ mapping=mapping,
4291
+ data=data,
4292
+ stat=stat,
4293
+ position=position,
4294
+ show_legend=show_legend,
4295
+ inherit_aes=inherit_aes,
4296
+ manual_key=manual_key,
4297
+ sampling=sampling,
4298
+ tooltips=tooltips,
4299
+ orientation=orientation,
4300
+ seed=seed,
4301
+ show_half=show_half,
4302
+ quantiles=quantiles,
4303
+ scale=scale, trim=trim, tails_cutoff=tails_cutoff, kernel=kernel, bw=bw, adjust=adjust, n=n,
4304
+ fs_max=fs_max,
4305
+ color_by=color_by, fill_by=fill_by,
4306
+ **other_args)
4307
+
4308
+
4101
4309
  def geom_ydotplot(mapping=None, *, data=None, show_legend=None, inherit_aes=None,
4102
4310
  manual_key=None, sampling=None,
4103
4311
  tooltips=None,
@@ -4316,7 +4524,7 @@ def geom_area_ridges(mapping=None, *, data=None, stat=None, position=None, show_
4316
4524
  'densityridges' (computes and draws kernel density estimate for each ridge).
4317
4525
  position : str or `FeatureSpec`, default='identity'
4318
4526
  Position adjustment.
4319
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
4527
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
4320
4528
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
4321
4529
  show_legend : bool, default=True
4322
4530
  False - do not show legend for this layer.
@@ -4504,7 +4712,7 @@ def geom_ribbon(mapping=None, *, data=None, stat=None, position=None, show_legen
4504
4712
  The statistical transformation to use on the data for this layer, as a string.
4505
4713
  position : str or `FeatureSpec`, default='identity'
4506
4714
  Position adjustment.
4507
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
4715
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
4508
4716
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
4509
4717
  show_legend : bool, default=True
4510
4718
  False - do not show legend for this layer.
@@ -4635,7 +4843,7 @@ def geom_area(mapping=None, *, data=None, stat=None, position=None, show_legend=
4635
4843
  'density' (computes and draws kernel density estimate).
4636
4844
  position : str or `FeatureSpec`, default='gstack'
4637
4845
  Position adjustment.
4638
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
4846
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
4639
4847
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
4640
4848
  show_legend : bool, default=True
4641
4849
  False - do not show legend for this layer.
@@ -4780,7 +4988,7 @@ def geom_density(mapping=None, *, data=None, stat=None, position=None, show_lege
4780
4988
  'density' (computes and draws kernel density estimate).
4781
4989
  position : str or `FeatureSpec`, default='identity'
4782
4990
  Position adjustment.
4783
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
4991
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
4784
4992
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
4785
4993
  show_legend : bool, default=True
4786
4994
  False - do not show legend for this layer.
@@ -5000,7 +5208,7 @@ def geom_density2d(mapping=None, *, data=None, stat=None, position=None, show_le
5000
5208
  The statistical transformation to use on the data for this layer, as a string.
5001
5209
  position : str or `FeatureSpec`, default='identity'
5002
5210
  Position adjustment.
5003
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
5211
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
5004
5212
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
5005
5213
  show_legend : bool, default=True
5006
5214
  False - do not show legend for this layer.
@@ -5236,7 +5444,7 @@ def geom_density2df(mapping=None, *, data=None, stat=None, position=None, show_l
5236
5444
  The statistical transformation to use on the data for this layer, as a string.
5237
5445
  position : str or `FeatureSpec`, default='identity'
5238
5446
  Position adjustment.
5239
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
5447
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
5240
5448
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
5241
5449
  show_legend : bool, default=True
5242
5450
  False - do not show legend for this layer.
@@ -5471,9 +5679,9 @@ def geom_jitter(mapping=None, *, data=None, stat=None, position=None, show_legen
5471
5679
  'bin' (counts number of points with x-axis coordinate in the same bin),
5472
5680
  'smooth' (performs smoothing - linear default),
5473
5681
  'density' (computes and draws kernel density estimate).
5474
- position : str or `FeatureSpec`, default='jitter'
5682
+ position : str or `FeatureSpec`, default=position_jitter(width=.4, height=.4)
5475
5683
  Position adjustment.
5476
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
5684
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
5477
5685
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
5478
5686
  show_legend : bool, default=True
5479
5687
  False - do not show legend for this layer.
@@ -5617,7 +5825,7 @@ def geom_qq(mapping=None, *, data=None, stat=None, position=None, show_legend=No
5617
5825
  'density' (computes and draws kernel density estimate).
5618
5826
  position : str or `FeatureSpec`, default='identity'
5619
5827
  Position adjustment.
5620
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
5828
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
5621
5829
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
5622
5830
  show_legend : bool, default=True
5623
5831
  False - do not show legend for this layer.
@@ -5759,7 +5967,7 @@ def geom_qq2(mapping=None, *, data=None, stat=None, position=None, show_legend=N
5759
5967
  'density' (computes and draws kernel density estimate).
5760
5968
  position : str or `FeatureSpec`, default='identity'
5761
5969
  Position adjustment.
5762
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
5970
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
5763
5971
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
5764
5972
  show_legend : bool, default=True
5765
5973
  False - do not show legend for this layer.
@@ -5877,7 +6085,7 @@ def geom_qq_line(mapping=None, *, data=None, stat=None, position=None, show_lege
5877
6085
  'density' (computes and draws kernel density estimate).
5878
6086
  position : str or `FeatureSpec`, default='identity'
5879
6087
  Position adjustment.
5880
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
6088
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
5881
6089
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
5882
6090
  show_legend : bool, default=True
5883
6091
  False - do not show legend for this layer.
@@ -6012,7 +6220,7 @@ def geom_qq2_line(mapping=None, *, data=None, stat=None, position=None, show_leg
6012
6220
  'density' (computes and draws kernel density estimate).
6013
6221
  position : str or `FeatureSpec`, default='identity'
6014
6222
  Position adjustment.
6015
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
6223
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
6016
6224
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
6017
6225
  show_legend : bool, default=True
6018
6226
  False - do not show legend for this layer.
@@ -6115,7 +6323,7 @@ def geom_freqpoly(mapping=None, *, data=None, stat=None, position=None, show_leg
6115
6323
  'density' (computes and draws kernel density estimate).
6116
6324
  position : str or `FeatureSpec`, default='identity'
6117
6325
  Position adjustment.
6118
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
6326
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
6119
6327
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
6120
6328
  show_legend : bool, default=True
6121
6329
  False - do not show legend for this layer.
@@ -6244,7 +6452,7 @@ def geom_step(mapping=None, *, data=None, stat=None, position=None, show_legend=
6244
6452
  'density' (computes and draws kernel density estimate).
6245
6453
  position : str or `FeatureSpec`, default='identity'
6246
6454
  Position adjustment.
6247
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
6455
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
6248
6456
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
6249
6457
  show_legend : bool, default=True
6250
6458
  False - do not show legend for this layer.
@@ -6366,7 +6574,7 @@ def geom_rect(mapping=None, *, data=None, stat=None, position=None, show_legend=
6366
6574
  The statistical transformation to use on the data for this layer, as a string.
6367
6575
  position : str or `FeatureSpec`, default='identity'
6368
6576
  Position adjustment.
6369
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
6577
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
6370
6578
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
6371
6579
  show_legend : bool, default=True
6372
6580
  False - do not show legend for this layer.
@@ -6545,7 +6753,7 @@ def geom_segment(mapping=None, *, data=None, stat=None, position=None, show_lege
6545
6753
  'density' (computes and draws kernel density estimate).
6546
6754
  position : str or `FeatureSpec`, default='identity'
6547
6755
  Position adjustment.
6548
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
6756
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
6549
6757
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
6550
6758
  show_legend : bool, default=True
6551
6759
  False - do not show legend for this layer.
@@ -6707,7 +6915,7 @@ def geom_curve(mapping=None, *, data=None, stat=None, position=None, show_legend
6707
6915
  'density' (computes and draws kernel density estimate).
6708
6916
  position : str or `FeatureSpec`, default='identity'
6709
6917
  Position adjustment.
6710
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
6918
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
6711
6919
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
6712
6920
  show_legend : bool, default=True
6713
6921
  False - do not show legend for this layer.
@@ -6860,7 +7068,7 @@ def geom_spoke(mapping=None, *, data=None, position=None, show_legend=None, inhe
6860
7068
  is inherited from the plot data as specified in the call to ggplot.
6861
7069
  position : str or `FeatureSpec`, default='identity'
6862
7070
  Position adjustment.
6863
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
7071
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
6864
7072
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
6865
7073
  show_legend : bool, default=True
6866
7074
  False - do not show legend for this layer.
@@ -7012,7 +7220,7 @@ def geom_text(mapping=None, *, data=None, stat=None, position=None, show_legend=
7012
7220
  'density' (computes and draws kernel density estimate).
7013
7221
  position : str or `FeatureSpec`, default='identity'
7014
7222
  Position adjustment.
7015
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
7223
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
7016
7224
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
7017
7225
  show_legend : bool, default=True
7018
7226
  False - do not show legend for this layer.
@@ -7054,8 +7262,11 @@ def geom_text(mapping=None, *, data=None, stat=None, position=None, show_legend=
7054
7262
  Horizontal adjustment to nudge labels by.
7055
7263
  nudge_y : float
7056
7264
  Vertical adjustment to nudge labels by.
7057
- size_unit : {'x', 'y'}
7265
+ size_unit : {'x', 'y', 'min', 'max'}
7058
7266
  Relate the size of the text to the length of the unit step along one of the axes.
7267
+ 'x' uses the unit step along the x-axis, 'y' uses the unit step along the y-axis.
7268
+ 'min' uses the smaller of the unit steps along x and y axes.
7269
+ 'max' uses the larger of the unit steps along x and y axes.
7059
7270
  If None, no fitting is performed.
7060
7271
  nudge_unit : {'identity', 'size', 'px'}, default='identity'
7061
7272
  Units for x and y nudging.
@@ -7094,8 +7305,8 @@ def geom_text(mapping=None, *, data=None, stat=None, position=None, show_legend=
7094
7305
  - label : text to add to plot.
7095
7306
  - family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
7096
7307
  - 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', 'middle', 'right' or number between 0 ('left') and 1 ('right'). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
7098
- - vjust : vertical text alignment. Possible values: 'bottom', 'center', 'top' or number between 0 ('bottom') and 1 ('top'). There are two special alignments: 'inward' (aligns text towards the plot center) and 'outward' (away from the plot center).
7308
+ - 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).
7309
+ - 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
7310
  - angle : text rotation angle in degrees.
7100
7311
  - lineheight : line height multiplier applied to the font size in the case of multi-line text.
7101
7312
 
@@ -7258,7 +7469,7 @@ def geom_label(mapping=None, *, data=None, stat=None, position=None, show_legend
7258
7469
  'density' (computes and draws kernel density estimate).
7259
7470
  position : str or `FeatureSpec`, default='identity'
7260
7471
  Position adjustment.
7261
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
7472
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
7262
7473
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
7263
7474
  show_legend : bool, default=True
7264
7475
  False - do not show legend for this layer.
@@ -7308,8 +7519,11 @@ def geom_label(mapping=None, *, data=None, stat=None, position=None, show_legend
7308
7519
  Size of label border.
7309
7520
  alpha_stroke : bool, default=False
7310
7521
  Enable the applying of 'alpha' to 'color' (label text and border).
7311
- size_unit : {'x', 'y'}
7522
+ size_unit : {'x', 'y', 'min', 'max'}
7312
7523
  Relate the size of the text label to the length of the unit step along one of the axes.
7524
+ 'x' uses the unit step along the x-axis, 'y' uses the unit step along the y-axis.
7525
+ 'min' uses the smaller of the unit steps along x and y axes.
7526
+ 'max' uses the larger of the unit steps along x and y axes.
7313
7527
  If None, no fitting is performed.
7314
7528
  nudge_unit : {'identity', 'size', 'px'}, default='identity'
7315
7529
  Units for x and y nudging.
@@ -7351,8 +7565,8 @@ def geom_label(mapping=None, *, data=None, stat=None, position=None, show_legend
7351
7565
  - label : text to add to plot.
7352
7566
  - family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
7353
7567
  - 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', 'middle', 'right' or number between 0 ('left') and 1 ('right'). There are two special alignments: 'inward' (aligns label towards the plot center) and 'outward' (away from the plot center).
7355
- - vjust : vertical alignment. Possible values: 'bottom', 'center', 'top' or number between 0 ('bottom') and 1 ('top'). There are two special alignments: 'inward' (aligns label towards the plot center) and 'outward' (away from the plot center).
7568
+ - 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).
7569
+ - 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
7570
  - angle : rotation angle in degrees.
7357
7571
  - lineheight : line height multiplier applied to the font size in the case of multi-line text.
7358
7572
 
@@ -7484,20 +7698,29 @@ def geom_label(mapping=None, *, data=None, stat=None, position=None, show_legend
7484
7698
  color_by=color_by, fill_by=fill_by,
7485
7699
  **other_args)
7486
7700
 
7487
-
7488
- def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
7489
- manual_key=None, sampling=None,
7490
- tooltips=None, labels=None,
7491
- map=None, map_join=None, use_crs=None,
7492
- hole=None,
7493
- stroke_side=None,
7494
- spacer_width=None, spacer_color=None,
7495
- start=None, direction=None,
7496
- size_unit=None,
7497
- color_by=None, fill_by=None,
7498
- **other_args):
7701
+ def geom_text_repel(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
7702
+ manual_key=None, sampling=None,
7703
+ tooltips=None,
7704
+ map=None, map_join=None, use_crs=None,
7705
+ label_format=None,
7706
+ na_text=None,
7707
+ nudge_x=None, nudge_y=None,
7708
+ size_unit=None,
7709
+ nudge_unit=None,
7710
+ check_overlap=None,
7711
+ color_by=None,
7712
+ seed=None,
7713
+ max_iter=None,
7714
+ max_time=None,
7715
+ direction=None,
7716
+ point_padding=None,
7717
+ box_padding=None,
7718
+ max_overlaps=None,
7719
+ min_segment_length=None,
7720
+ arrow=None,
7721
+ **other_args):
7499
7722
  """
7500
- Draw pie chart.
7723
+ Add text labels that repel away from each other and from data points.
7501
7724
 
7502
7725
  Parameters
7503
7726
  ----------
@@ -7508,10 +7731,13 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
7508
7731
  data : dict or Pandas or Polars `DataFrame` or `GeoDataFrame`
7509
7732
  The data to be displayed in this layer. If None, the default, the data
7510
7733
  is inherited from the plot data as specified in the call to ggplot.
7511
- stat : str, default='count2d'
7734
+ stat : str, default='identity'
7512
7735
  The statistical transformation to use on the data for this layer, as a string.
7513
7736
  Supported transformations: 'identity' (leaves the data unchanged),
7514
- 'count2d' (counts number of points with same x,y coordinate).
7737
+ 'count' (counts number of points with same x-axis coordinate),
7738
+ 'bin' (counts number of points with x-axis coordinate in the same bin),
7739
+ 'smooth' (performs smoothing - linear default),
7740
+ 'density' (computes and draws kernel density estimate).
7515
7741
  position : str or `FeatureSpec`, default='identity'
7516
7742
  Position adjustment.
7517
7743
  Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
@@ -7530,9 +7756,6 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
7530
7756
  Result of the call to the `layer_tooltips()` function.
7531
7757
  Specify appearance, style and content.
7532
7758
  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
7759
  map : `GeoDataFrame` or `Geocoder`
7537
7760
  Data containing coordinates of points.
7538
7761
  map_join : str or list
@@ -7544,13 +7767,446 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
7544
7767
  If an EPSG code is given, then all the coordinates in `GeoDataFrame` (see the `map` parameter)
7545
7768
  will be projected to this CRS.
7546
7769
  Specify "provided" to disable any further re-projection and to keep the `GeoDataFrame's` original CRS.
7547
- hole : float, default=0.0
7548
- A multiplicative factor applied to the pie diameter to draw donut-like chart.
7549
- Accept values between 0 and 1.
7550
- stroke_side : {'outer', 'inner', 'both'}, default='both'
7551
- Define which arcs of pie sector should have a stroke.
7552
- spacer_width : float, default=0.75
7553
- Line width between sectors in pixels.
7770
+ label_format : str
7771
+ Format used to transform label mapping values to a string.
7772
+ Examples:
7773
+
7774
+ - '.2f' -> '12.45'
7775
+ - 'Num {}' -> 'Num 12.456789'
7776
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
7777
+
7778
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
7779
+ na_text : str, default='n/a'
7780
+ Text to show for missing values.
7781
+ nudge_x : float
7782
+ Horizontal adjustment to nudge labels by.
7783
+ nudge_y : float
7784
+ Vertical adjustment to nudge labels by.
7785
+ size_unit : {'x', 'y', 'min', 'max'}
7786
+ Relate the size of the text to the length of the unit step along one of the axes.
7787
+ 'x' uses the unit step along the x-axis, 'y' uses the unit step along the y-axis.
7788
+ 'min' uses the smaller of the unit steps along x and y axes.
7789
+ 'max' uses the larger of the unit steps along x and y axes.
7790
+ If None, no fitting is performed.
7791
+ nudge_unit : {'identity', 'size', 'px'}, default='identity'
7792
+ Units for x and y nudging.
7793
+ Possible values:
7794
+
7795
+ - 'identity': a unit of 1 corresponds to a difference of 1 in data space;
7796
+ - 'size': a unit of 1 corresponds to the diameter of a point with `size=1`;
7797
+ - 'px': the unit is measured in screen pixels.
7798
+
7799
+ check_overlap : bool, default=False
7800
+ If True, skip plotting text that overlaps previous text in the same layer.
7801
+ color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
7802
+ Define the color aesthetic for the geometry.
7803
+ seed : int
7804
+ Random seed used for reproducibility of label positions.
7805
+ max_iter : int
7806
+ Maximum number of iterations used to resolve label collisions.
7807
+ max_time : float
7808
+ Maximum allowed time in seconds for resolving label collisions.
7809
+ direction : {'both', 'x', 'y'}, default='both'
7810
+ Limit direction of repulsion movement.
7811
+ point_padding : float
7812
+ Padding around data points to avoid label overlap.
7813
+ box_padding : float
7814
+ Padding around text labels to avoid label-label overlap.
7815
+ max_overlaps : int
7816
+ Maximum number of overlapping labels allowed. Labels beyond this number will be hidden.
7817
+ min_segment_length : float
7818
+ Minimum length of the line segment connecting the label to the point.
7819
+ Shorter segments will be omitted.
7820
+ arrow : `FeatureSpec`
7821
+ Specification for arrow head, as created by `arrow()` function.
7822
+ other_args
7823
+ Other arguments passed on to the layer.
7824
+ These are often aesthetics settings used to set an aesthetic to a fixed value,
7825
+ like color='red', fill='blue', size=3 or shape=21.
7826
+ They may also be parameters to the paired geom/stat.
7827
+
7828
+ Returns
7829
+ -------
7830
+ `LayerSpec`
7831
+ Geom object specification.
7832
+
7833
+ Notes
7834
+ -----
7835
+ Adds text annotations to the plot using a force-based layout algorithm
7836
+ designed to prevent overlaps. Labels repel each other and the data points they annotate,
7837
+ resulting in a clearer and more readable visualization.
7838
+
7839
+ This is based on the "repelling labels" idea from the ggrepel package in R,
7840
+ and is especially useful for annotating crowded plots while minimizing collisions
7841
+ between text elements or label boxes.
7842
+
7843
+ `geom_text_repel()` understands the following aesthetics mappings:
7844
+
7845
+ - x : x-axis value.
7846
+ - y : y-axis value.
7847
+ - alpha : transparency level of a layer. Accept values between 0 and 1.
7848
+ - color (colour) : color of the geometry. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
7849
+ - size : font size.
7850
+ - label : text to add to plot.
7851
+ - family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
7852
+ - fontface : font style and weight. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
7853
+ - 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).
7854
+ - 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).
7855
+ - angle : text rotation angle in degrees.
7856
+ - lineheight : line height multiplier applied to the font size in the case of multi-line text.
7857
+ - 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>`__.
7858
+ - point_size : A value representing the visual size of the point associated with the label.
7859
+ - point_stroke : Width of the point border.
7860
+ - segment_color : Color of the line segment connecting the label to the point.
7861
+ - segment_size : Width of the line segment connecting the label to the point.
7862
+ - segment_alpha : Transparency level of the line segment. Accept values between 0 and 1.
7863
+ - 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>`__.
7864
+
7865
+ Examples
7866
+ --------
7867
+ .. jupyter-execute::
7868
+ :linenos:
7869
+ :emphasize-lines: 10
7870
+
7871
+ from lets_plot import *
7872
+ LetsPlot.setup_html()
7873
+ data = {
7874
+ "x": [-0.5, 0.5],
7875
+ "y": [0, 0],
7876
+ "label": ["Lorem ipsum", "dolor sit amet"]
7877
+ }
7878
+ ggplot(data, aes("x", "y")) + \\
7879
+ geom_point(size=20) + \\
7880
+ geom_text_repel(aes(label="label"), point_size=20, size=10, seed=42) + \\
7881
+ xlim(-1.2, 1.2) + ylim(-1.2, 1.2)
7882
+
7883
+ """
7884
+ return _geom('text_repel',
7885
+ mapping=mapping,
7886
+ data=data,
7887
+ stat=stat,
7888
+ position=position,
7889
+ show_legend=show_legend,
7890
+ inherit_aes=inherit_aes,
7891
+ manual_key=manual_key,
7892
+ sampling=sampling,
7893
+ tooltips=tooltips,
7894
+ map=map, map_join=map_join, use_crs=use_crs,
7895
+ label_format=label_format,
7896
+ na_text=na_text,
7897
+ nudge_x=nudge_x, nudge_y=nudge_y,
7898
+ size_unit=size_unit,
7899
+ nudge_unit=nudge_unit,
7900
+ check_overlap=check_overlap,
7901
+ color_by=color_by,
7902
+ max_iter=max_iter,
7903
+ max_time=max_time,
7904
+ seed=seed,
7905
+ direction=direction,
7906
+ point_padding = point_padding,
7907
+ box_padding = box_padding,
7908
+ max_overlaps = max_overlaps,
7909
+ min_segment_length = min_segment_length,
7910
+ arrow=arrow,
7911
+ **other_args)
7912
+
7913
+ def geom_label_repel(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
7914
+ manual_key=None, sampling=None,
7915
+ tooltips=None,
7916
+ map=None, map_join=None, use_crs=None,
7917
+ label_format=None,
7918
+ na_text=None,
7919
+ nudge_x=None, nudge_y=None,
7920
+ label_padding=None, label_r=None, label_size=None,
7921
+ alpha_stroke=None,
7922
+ size_unit=None,
7923
+ nudge_unit=None,
7924
+ check_overlap=None,
7925
+ color_by=None, fill_by=None,
7926
+ seed=None,
7927
+ max_iter=None,
7928
+ max_time=None,
7929
+ direction=None,
7930
+ point_padding=None,
7931
+ box_padding=None,
7932
+ max_overlaps=None,
7933
+ min_segment_length=None,
7934
+ arrow=None,
7935
+ **other_args):
7936
+
7937
+ """
7938
+ Add repelling text labels with background boxes to the plot.
7939
+
7940
+ Parameters
7941
+ ----------
7942
+ mapping : `FeatureSpec`
7943
+ Set of aesthetic mappings created by `aes()` function.
7944
+ Aesthetic mappings describe the way that variables in the data are
7945
+ mapped to plot "aesthetics".
7946
+ data : dict or Pandas or Polars `DataFrame` or `GeoDataFrame`
7947
+ The data to be displayed in this layer. If None, the default, the data
7948
+ is inherited from the plot data as specified in the call to ggplot.
7949
+ stat : str, default='identity'
7950
+ The statistical transformation to use on the data for this layer, as a string.
7951
+ Supported transformations: 'identity' (leaves the data unchanged),
7952
+ 'count' (counts number of points with same x-axis coordinate),
7953
+ 'bin' (counts number of points with x-axis coordinate in the same bin),
7954
+ 'smooth' (performs smoothing - linear default),
7955
+ 'density' (computes and draws kernel density estimate).
7956
+ position : str or `FeatureSpec`, default='identity'
7957
+ Position adjustment.
7958
+ Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
7959
+ 'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
7960
+ show_legend : bool, default=True
7961
+ False - do not show legend for this layer.
7962
+ inherit_aes : bool, default=True
7963
+ False - do not combine the layer aesthetic mappings with the plot shared mappings.
7964
+ manual_key : str or `layer_key`
7965
+ The key to show in the manual legend.
7966
+ Specify text for the legend label or advanced settings using the `layer_key()` function.
7967
+ sampling : `FeatureSpec`
7968
+ Result of the call to the `sampling_xxx()` function.
7969
+ To prevent any sampling for this layer pass value "none" (string "none").
7970
+ tooltips : `layer_tooltips`
7971
+ Result of the call to the `layer_tooltips()` function.
7972
+ Specify appearance, style and content.
7973
+ Set tooltips='none' to hide tooltips from the layer.
7974
+ map : `GeoDataFrame` or `Geocoder`
7975
+ Data containing coordinates of points.
7976
+ map_join : str or list
7977
+ Keys used to join map coordinates with data.
7978
+ First value in pair - column/columns in `data`.
7979
+ Second value in pair - column/columns in `map`.
7980
+ use_crs : str, optional, default="EPSG:4326" (aka WGS84)
7981
+ EPSG code of the coordinate reference system (CRS) or the keyword "provided".
7982
+ If an EPSG code is given, then all the coordinates in `GeoDataFrame` (see the `map` parameter)
7983
+ will be projected to this CRS.
7984
+ Specify "provided" to disable any further re-projection and to keep the `GeoDataFrame's` original CRS.
7985
+ label_format : str
7986
+ Format used to transform label mapping values to a string.
7987
+ Examples:
7988
+
7989
+ - '.2f' -> '12.45'
7990
+ - 'Num {}' -> 'Num 12.456789'
7991
+ - 'TTL: {.2f}$' -> 'TTL: 12.45$'
7992
+
7993
+ For more info see `Formatting <https://lets-plot.org/python/pages/formats.html>`__.
7994
+ nudge_x : float
7995
+ Horizontal adjustment to nudge labels by.
7996
+ nudge_y : float
7997
+ Vertical adjustment to nudge labels by.
7998
+ na_text : str, default='n/a'
7999
+ Text to show for missing values.
8000
+ label_padding : float
8001
+ Amount of padding around label. Default is 0.25 of font size.
8002
+ label_r : float
8003
+ Radius of rounded corners. Default is 0.15 of label height.
8004
+ label_size : float, default = 1.0
8005
+ Size of label border.
8006
+ alpha_stroke : bool, default=False
8007
+ Enable the applying of 'alpha' to 'color' (label text and border).
8008
+ size_unit : {'x', 'y', 'min', 'max'}
8009
+ Relate the size of the text label to the length of the unit step along one of the axes.
8010
+ 'x' uses the unit step along the x-axis, 'y' uses the unit step along the y-axis.
8011
+ 'min' uses the smaller of the unit steps along x and y axes.
8012
+ 'max' uses the larger of the unit steps along x and y axes.
8013
+ If None, no fitting is performed.
8014
+ nudge_unit : {'identity', 'size', 'px'}, default='identity'
8015
+ Units for x and y nudging.
8016
+ Possible values:
8017
+
8018
+ - 'identity': a unit of 1 corresponds to a difference of 1 in data space;
8019
+ - 'size': a unit of 1 corresponds to the diameter of a point with `size=1`;
8020
+ - 'px': the unit is measured in screen pixels.
8021
+
8022
+ check_overlap : bool, default=False
8023
+ If True, skip plotting text that overlaps previous text in the same layer.
8024
+ color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
8025
+ Define the color aesthetic for the geometry.
8026
+ fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
8027
+ Define the fill aesthetic for the geometry.
8028
+ seed : int
8029
+ Random seed for reproducibility.
8030
+ max_iter : int
8031
+ Maximum number of iterations for the repulsion algorithm.
8032
+ max_time : float
8033
+ Maximum allowed time in seconds for resolving label collisions.
8034
+ direction : {'both', 'x', 'y'}, default='both'
8035
+ Direction in which labels can be moved.
8036
+ point_padding : float
8037
+ Padding around the data point.
8038
+ box_padding : float
8039
+ Padding around the label box.
8040
+ max_overlaps : int
8041
+ Max number of overlapping labels to allow.
8042
+ min_segment_length : float
8043
+ Minimum length of the connecting line segment. Shorter ones are omitted.
8044
+ arrow : `FeatureSpec`
8045
+ Specification for arrow head, as created by `arrow()` function.
8046
+ other_args
8047
+ Other arguments passed on to the layer.
8048
+ These are often aesthetics settings used to set an aesthetic to a fixed value,
8049
+ like color='red', fill='blue', size=3 or shape=21.
8050
+ They may also be parameters to the paired geom/stat.
8051
+
8052
+ Returns
8053
+ -------
8054
+ `LayerSpec`
8055
+ Geom object specification.
8056
+
8057
+ Notes
8058
+ -----
8059
+ Adds label annotations to the plot using a force-based layout algorithm
8060
+ designed to prevent overlaps. Labels repel each other and the data points they annotate,
8061
+ resulting in a clearer and more readable visualization.
8062
+
8063
+ This is based on the "repelling labels" idea from the ggrepel package in R,
8064
+ and is especially useful for annotating crowded plots while minimizing collisions
8065
+ between text elements or label boxes.
8066
+
8067
+ `geom_label_repel()` understands the following aesthetics mappings:
8068
+
8069
+ - x : x-axis value.
8070
+ - y : y-axis value.
8071
+ - alpha : transparency level of a layer. Accept values between 0 and 1.
8072
+ - color (colour) : color of the geometry. For more info see `Color and Fill <https://lets-plot.org/python/pages/aesthetics.html#color-and-fill>`__.
8073
+ - fill: background color of the label.
8074
+ - size : font size.
8075
+ - label : text to add to plot.
8076
+ - family : font family. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
8077
+ - fontface : font style and weight. For more info see `Text <https://lets-plot.org/python/pages/aesthetics.html#text>`__.
8078
+ - 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).
8079
+ - 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).
8080
+ - angle : rotation angle in degrees.
8081
+ - lineheight : line height multiplier applied to the font size in the case of multi-line text.
8082
+ - 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>`__.
8083
+ - point_size : A value representing the visual size of the point associated with the label.
8084
+ - point_stroke : Width of the point border.
8085
+ - segment_color : Color of the line segment connecting the label to the point.
8086
+ - segment_size : Width of the line segment connecting the label to the point.
8087
+ - segment_alpha : Transparency level of the line segment. Accept values between 0 and 1.
8088
+ - 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>`__.
8089
+
8090
+ Examples
8091
+ --------
8092
+ .. jupyter-execute::
8093
+ :linenos:
8094
+ :emphasize-lines: 10
8095
+
8096
+ from lets_plot import *
8097
+ LetsPlot.setup_html()
8098
+ data = {
8099
+ "x": [-0.5, 0.5],
8100
+ "y": [0, 0],
8101
+ "label": ["Lorem ipsum", "dolor sit amet"]
8102
+ }
8103
+ ggplot(data, aes("x", "y")) + \\
8104
+ geom_point(size=20) + \\
8105
+ geom_label_repel(aes(label="label"), point_size=20, size=10, seed=42) + \\
8106
+ xlim(-1.2, 1.2) + ylim(-1.2, 1.2)
8107
+
8108
+ """
8109
+
8110
+ return _geom('label_repel',
8111
+ mapping=mapping,
8112
+ data=data,
8113
+ stat=stat,
8114
+ position=position,
8115
+ show_legend=show_legend,
8116
+ inherit_aes=inherit_aes,
8117
+ manual_key=manual_key,
8118
+ sampling=sampling,
8119
+ tooltips=tooltips,
8120
+ map=map, map_join=map_join, use_crs=use_crs,
8121
+ label_format=label_format,
8122
+ na_text=na_text,
8123
+ nudge_x=nudge_x, nudge_y=nudge_y,
8124
+ label_padding=label_padding,
8125
+ label_r=label_r,
8126
+ label_size=label_size,
8127
+ alpha_stroke=alpha_stroke,
8128
+ size_unit=size_unit,
8129
+ nudge_unit=nudge_unit,
8130
+ check_overlap=check_overlap,
8131
+ color_by=color_by, fill_by=fill_by,
8132
+ max_iter=max_iter,
8133
+ max_time=max_time,
8134
+ seed=seed,
8135
+ direction=direction,
8136
+ point_padding = point_padding,
8137
+ box_padding = box_padding,
8138
+ max_overlaps = max_overlaps,
8139
+ min_segment_length = min_segment_length,
8140
+ arrow=arrow,
8141
+ **other_args)
8142
+
8143
+
8144
+ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
8145
+ manual_key=None, sampling=None,
8146
+ tooltips=None, labels=None,
8147
+ map=None, map_join=None, use_crs=None,
8148
+ hole=None,
8149
+ stroke_side=None,
8150
+ spacer_width=None, spacer_color=None,
8151
+ start=None, direction=None,
8152
+ size_unit=None,
8153
+ color_by=None, fill_by=None,
8154
+ **other_args):
8155
+ """
8156
+ Draw pie chart.
8157
+
8158
+ Parameters
8159
+ ----------
8160
+ mapping : `FeatureSpec`
8161
+ Set of aesthetic mappings created by `aes()` function.
8162
+ Aesthetic mappings describe the way that variables in the data are
8163
+ mapped to plot "aesthetics".
8164
+ data : dict or Pandas or Polars `DataFrame` or `GeoDataFrame`
8165
+ The data to be displayed in this layer. If None, the default, the data
8166
+ is inherited from the plot data as specified in the call to ggplot.
8167
+ stat : str, default='count2d'
8168
+ The statistical transformation to use on the data for this layer, as a string.
8169
+ Supported transformations: 'identity' (leaves the data unchanged),
8170
+ 'count2d' (counts number of points with same x,y coordinate).
8171
+ position : str or `FeatureSpec`, default='identity'
8172
+ Position adjustment.
8173
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
8174
+ 'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
8175
+ show_legend : bool, default=True
8176
+ False - do not show legend for this layer.
8177
+ inherit_aes : bool, default=True
8178
+ False - do not combine the layer aesthetic mappings with the plot shared mappings.
8179
+ manual_key : str or `layer_key`
8180
+ The key to show in the manual legend.
8181
+ Specify text for the legend label or advanced settings using the `layer_key()` function.
8182
+ sampling : `FeatureSpec`
8183
+ Result of the call to the `sampling_xxx()` function.
8184
+ To prevent any sampling for this layer pass value "none" (string "none").
8185
+ tooltips : `layer_tooltips`
8186
+ Result of the call to the `layer_tooltips()` function.
8187
+ Specify appearance, style and content.
8188
+ Set tooltips='none' to hide tooltips from the layer.
8189
+ labels : `layer_labels`
8190
+ Result of the call to the `layer_labels()` function.
8191
+ Specify style and content of the annotations.
8192
+ map : `GeoDataFrame` or `Geocoder`
8193
+ Data containing coordinates of points.
8194
+ map_join : str or list
8195
+ Keys used to join map coordinates with data.
8196
+ First value in pair - column/columns in `data`.
8197
+ Second value in pair - column/columns in `map`.
8198
+ use_crs : str, optional, default="EPSG:4326" (aka WGS84)
8199
+ EPSG code of the coordinate reference system (CRS) or the keyword "provided".
8200
+ If an EPSG code is given, then all the coordinates in `GeoDataFrame` (see the `map` parameter)
8201
+ will be projected to this CRS.
8202
+ Specify "provided" to disable any further re-projection and to keep the `GeoDataFrame's` original CRS.
8203
+ hole : float, default=0.0
8204
+ A multiplicative factor applied to the pie diameter to draw donut-like chart.
8205
+ Accept values between 0 and 1.
8206
+ stroke_side : {'outer', 'inner', 'both'}, default='both'
8207
+ Define which arcs of pie sector should have a stroke.
8208
+ spacer_width : float, default=0.75
8209
+ Line width between sectors in pixels.
7554
8210
  Spacers are not applied to exploded sectors and to sides of adjacent sectors.
7555
8211
  spacer_color : str
7556
8212
  Color for spacers between sectors. By default, the "paper" color is used.
@@ -7559,8 +8215,11 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
7559
8215
  Default is a negative angle of the first sector.
7560
8216
  direction : {1, -1}, default=1
7561
8217
  Specify angle direction, 1=clockwise, -1=counter-clockwise.
7562
- size_unit : {'x', 'y'}
8218
+ size_unit : {'x', 'y', 'min', 'max'}
7563
8219
  Relate the size of the pie chart to the length of the unit step along one of the axes.
8220
+ 'x' uses the unit step along the x-axis, 'y' uses the unit step along the y-axis.
8221
+ 'min' uses the smaller of the unit steps along x and y axes.
8222
+ 'max' uses the larger of the unit steps along x and y axes.
7564
8223
  If None, no fitting is performed.
7565
8224
  color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
7566
8225
  Define the color aesthetic for the geometry.
@@ -7771,7 +8430,7 @@ def geom_lollipop(mapping=None, *, data=None, stat=None, position=None, show_leg
7771
8430
  'density' (computes and draws kernel density estimate).
7772
8431
  position : str or `FeatureSpec`, default='identity'
7773
8432
  Position adjustment.
7774
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
8433
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
7775
8434
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
7776
8435
  show_legend : bool, default=True
7777
8436
  False - do not show legend for this layer.
@@ -7927,7 +8586,7 @@ def geom_count(mapping=None, *, data=None, stat=None, position=None, show_legend
7927
8586
  The statistical transformation to use on the data for this layer, as a string.
7928
8587
  position : str or `FeatureSpec`, default='identity'
7929
8588
  Position adjustment.
7930
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
8589
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
7931
8590
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
7932
8591
  show_legend : bool, default=True
7933
8592
  False - do not show legend for this layer.
@@ -8059,7 +8718,7 @@ def geom_blank(mapping=None, *, data=None, stat=None, position=None, show_legend
8059
8718
  'sum' (counts the number of points at each location - might help to workaround overplotting).
8060
8719
  position : str or `FeatureSpec`, default='identity'
8061
8720
  Position adjustment.
8062
- Either a position adjustment name: 'dodge', 'dodgev', 'jitter', 'nudge', 'jitterdodge', 'fill',
8721
+ Either a position adjustment name: 'dodge', 'jitter', 'nudge', 'jitterdodge', 'fill',
8063
8722
  'stack' or 'identity', or the result of calling a position adjustment function (e.g., `position_dodge()` etc.).
8064
8723
  show_legend : bool, default=True
8065
8724
  False - do not show legend for this layer.