lets-plot 4.6.0a2__cp311-cp311-win_amd64.whl → 4.6.0rc1__cp311-cp311-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/_kbridge.py +52 -25
- lets_plot/_version.py +1 -1
- lets_plot/package_data/lets-plot.min.js +1 -1
- lets_plot/plot/geom.py +114 -38
- lets_plot/plot/pos.py +5 -3
- lets_plot/plot/scale.py +8 -8
- lets_plot/plot/theme_.py +87 -2
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.0rc1.dist-info}/METADATA +1 -1
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.0rc1.dist-info}/RECORD +13 -13
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.0rc1.dist-info}/WHEEL +1 -1
- lets_plot_kotlin_bridge.cp311-win_amd64.pyd +0 -0
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.0rc1.dist-info}/LICENSE +0 -0
- {lets_plot-4.6.0a2.dist-info → lets_plot-4.6.0rc1.dist-info}/top_level.txt +0 -0
lets_plot/plot/geom.py
CHANGED
|
@@ -1253,10 +1253,6 @@ def geom_bin2d(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
1253
1253
|
Apply a rectangular grid to the plane, count observations in each cell (bin) of the grid,
|
|
1254
1254
|
and map the count to the fill color of the cell (tile).
|
|
1255
1255
|
|
|
1256
|
-
By default, this geom uses `coord_fixed()`.
|
|
1257
|
-
However, this may not be the best choice when the values on the X/Y axis have significantly different magnitudes.
|
|
1258
|
-
In such cases, try using `coord_cartesian()`.
|
|
1259
|
-
|
|
1260
1256
|
Parameters
|
|
1261
1257
|
----------
|
|
1262
1258
|
mapping : `FeatureSpec`
|
|
@@ -1427,16 +1423,13 @@ def geom_hex(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
1427
1423
|
bins=None,
|
|
1428
1424
|
binwidth=None,
|
|
1429
1425
|
drop=None,
|
|
1426
|
+
width_unit=None, height_unit=None,
|
|
1430
1427
|
color_by=None, fill_by=None,
|
|
1431
1428
|
**other_args):
|
|
1432
1429
|
"""
|
|
1433
1430
|
Apply a hexagonal grid to the plane, count observations in each cell (hexagonal bin) of the grid,
|
|
1434
1431
|
and map the count to the fill color of the cell (hexagonal tile).
|
|
1435
1432
|
|
|
1436
|
-
By default, this geom uses `coord_fixed()`.
|
|
1437
|
-
However, this may not be the best choice when the values on the X/Y axis have significantly different magnitudes.
|
|
1438
|
-
In such cases, try using `coord_cartesian()`.
|
|
1439
|
-
|
|
1440
1433
|
Parameters
|
|
1441
1434
|
----------
|
|
1442
1435
|
mapping : `FeatureSpec`
|
|
@@ -1473,6 +1466,24 @@ def geom_hex(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
1473
1466
|
Override `bins`. The default is to use bin widths that cover the entire range of the data.
|
|
1474
1467
|
drop : bool, default=True
|
|
1475
1468
|
Specify whether to remove all hexagonal bins with 0 counts.
|
|
1469
|
+
width_unit : {'res', 'identity', 'size', 'px'}, default='identity'
|
|
1470
|
+
Unit for width of the hexagon.
|
|
1471
|
+
Possible values:
|
|
1472
|
+
|
|
1473
|
+
- 'res': value 1 corresponds to the resolution along the x-axis, i.e. the minimum distance between data points;
|
|
1474
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the x-axis;
|
|
1475
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
1476
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
1477
|
+
|
|
1478
|
+
height_unit : {'res', 'identity', 'size', 'px'}, default='identity'
|
|
1479
|
+
Unit for height of the hexagon.
|
|
1480
|
+
Possible values:
|
|
1481
|
+
|
|
1482
|
+
- 'res': value 1 corresponds to the resolution along the y-axis, i.e. the minimum distance between data points;
|
|
1483
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the y-axis;
|
|
1484
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
1485
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
1486
|
+
|
|
1476
1487
|
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
1477
1488
|
Define the color aesthetic for the geometry.
|
|
1478
1489
|
fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
|
|
@@ -1584,6 +1595,7 @@ def geom_hex(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
1584
1595
|
bins=bins,
|
|
1585
1596
|
binwidth=binwidth,
|
|
1586
1597
|
drop=drop,
|
|
1598
|
+
width_unit=width_unit, height_unit=height_unit,
|
|
1587
1599
|
color_by=color_by, fill_by=fill_by,
|
|
1588
1600
|
**other_args)
|
|
1589
1601
|
|
|
@@ -1591,6 +1603,7 @@ def geom_hex(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
1591
1603
|
def geom_tile(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
1592
1604
|
manual_key=None, sampling=None,
|
|
1593
1605
|
tooltips=None,
|
|
1606
|
+
width_unit=None, height_unit=None,
|
|
1594
1607
|
color_by=None, fill_by=None,
|
|
1595
1608
|
**other_args):
|
|
1596
1609
|
"""
|
|
@@ -1625,6 +1638,24 @@ def geom_tile(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
1625
1638
|
Result of the call to the `layer_tooltips()` function.
|
|
1626
1639
|
Specify appearance, style and content.
|
|
1627
1640
|
Set tooltips='none' to hide tooltips from the layer.
|
|
1641
|
+
width_unit : {'res', 'identity', 'size', 'px'}, default='res'
|
|
1642
|
+
Unit for width of the tile.
|
|
1643
|
+
Possible values:
|
|
1644
|
+
|
|
1645
|
+
- 'res': value 1 corresponds to the resolution along the x-axis, i.e. the minimum distance between data points;
|
|
1646
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the x-axis;
|
|
1647
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
1648
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
1649
|
+
|
|
1650
|
+
height_unit : {'res', 'identity', 'size', 'px'}, default='res'
|
|
1651
|
+
Unit for height of the tile.
|
|
1652
|
+
Possible values:
|
|
1653
|
+
|
|
1654
|
+
- 'res': value 1 corresponds to the resolution along the y-axis, i.e. the minimum distance between data points;
|
|
1655
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the y-axis;
|
|
1656
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
1657
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
1658
|
+
|
|
1628
1659
|
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
1629
1660
|
Define the color aesthetic for the geometry.
|
|
1630
1661
|
fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
|
|
@@ -1736,6 +1767,8 @@ def geom_tile(mapping=None, *, data=None, stat=None, position=None, show_legend=
|
|
|
1736
1767
|
manual_key=manual_key,
|
|
1737
1768
|
sampling=sampling,
|
|
1738
1769
|
tooltips=tooltips,
|
|
1770
|
+
width_unit=width_unit,
|
|
1771
|
+
height_unit=height_unit,
|
|
1739
1772
|
color_by=color_by, fill_by=fill_by,
|
|
1740
1773
|
**other_args)
|
|
1741
1774
|
|
|
@@ -1838,6 +1871,7 @@ def geom_raster(mapping=None, *, data=None, stat=None, position=None, show_legen
|
|
|
1838
1871
|
def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
1839
1872
|
manual_key=None,
|
|
1840
1873
|
sampling=None, tooltips=None,
|
|
1874
|
+
width_unit=None, height_unit=None,
|
|
1841
1875
|
color_by=None,
|
|
1842
1876
|
**other_args):
|
|
1843
1877
|
"""
|
|
@@ -1877,6 +1911,24 @@ def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
1877
1911
|
Result of the call to the `layer_tooltips()` function.
|
|
1878
1912
|
Specify appearance, style and content.
|
|
1879
1913
|
Set tooltips='none' to hide tooltips from the layer.
|
|
1914
|
+
width_unit : {'res', 'identity', 'size', 'px'}, default='res'
|
|
1915
|
+
Unit for the whisker width of the vertical error bar.
|
|
1916
|
+
Possible values:
|
|
1917
|
+
|
|
1918
|
+
- 'res': value 1 corresponds to the resolution along the x-axis, i.e. the minimum distance between data points;
|
|
1919
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the x-axis;
|
|
1920
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
1921
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
1922
|
+
|
|
1923
|
+
height_unit : {'res', 'identity', 'size', 'px'}, default='res'
|
|
1924
|
+
Unit for the whisker height of the horizontal error bar.
|
|
1925
|
+
Possible values:
|
|
1926
|
+
|
|
1927
|
+
- 'res': value 1 corresponds to the resolution along the y-axis, i.e. the minimum distance between data points;
|
|
1928
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the y-axis;
|
|
1929
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
1930
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
1931
|
+
|
|
1880
1932
|
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
1881
1933
|
Define the color aesthetic for the geometry.
|
|
1882
1934
|
other_args
|
|
@@ -1978,6 +2030,8 @@ def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
1978
2030
|
manual_key=manual_key,
|
|
1979
2031
|
sampling=sampling,
|
|
1980
2032
|
tooltips=tooltips,
|
|
2033
|
+
width_unit=width_unit,
|
|
2034
|
+
height_unit=height_unit,
|
|
1981
2035
|
color_by=color_by,
|
|
1982
2036
|
**other_args)
|
|
1983
2037
|
|
|
@@ -1985,6 +2039,7 @@ def geom_errorbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
1985
2039
|
def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_legend=None, inherit_aes=None,
|
|
1986
2040
|
manual_key=None, sampling=None, tooltips=None,
|
|
1987
2041
|
fatten=None,
|
|
2042
|
+
width_unit=None,
|
|
1988
2043
|
color_by=None, fill_by=None,
|
|
1989
2044
|
**other_args):
|
|
1990
2045
|
"""
|
|
@@ -2026,6 +2081,15 @@ def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
2026
2081
|
Set tooltips='none' to hide tooltips from the layer.
|
|
2027
2082
|
fatten : float, default=2.5
|
|
2028
2083
|
A multiplicative factor applied to size of the middle bar.
|
|
2084
|
+
width_unit : {'res', 'identity', 'size', 'px'}, default='res'
|
|
2085
|
+
Unit for the width of the crossbar.
|
|
2086
|
+
Possible values:
|
|
2087
|
+
|
|
2088
|
+
- 'res': value 1 corresponds to the resolution along the x-axis, i.e. the minimum distance between data points;
|
|
2089
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the x-axis;
|
|
2090
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
2091
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
2092
|
+
|
|
2029
2093
|
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
2030
2094
|
Define the color aesthetic for the geometry.
|
|
2031
2095
|
fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
|
|
@@ -2122,6 +2186,7 @@ def geom_crossbar(mapping=None, *, data=None, stat=None, position=None, show_leg
|
|
|
2122
2186
|
sampling=sampling,
|
|
2123
2187
|
tooltips=tooltips,
|
|
2124
2188
|
fatten=fatten,
|
|
2189
|
+
width_unit=width_unit,
|
|
2125
2190
|
color_by=color_by, fill_by=fill_by,
|
|
2126
2191
|
**other_args)
|
|
2127
2192
|
|
|
@@ -3552,6 +3617,7 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
3552
3617
|
outlier_shape=None, outlier_size=None, outlier_stroke=None,
|
|
3553
3618
|
varwidth=None,
|
|
3554
3619
|
whisker_width=None,
|
|
3620
|
+
width_unit=None,
|
|
3555
3621
|
color_by=None, fill_by=None,
|
|
3556
3622
|
**other_args):
|
|
3557
3623
|
"""
|
|
@@ -3609,6 +3675,15 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
3609
3675
|
of the number of observations in the groups.
|
|
3610
3676
|
whisker_width : float, default=0.5
|
|
3611
3677
|
A multiplicative factor applied to the box width to draw horizontal segments on whiskers.
|
|
3678
|
+
width_unit : {'res', 'identity', 'size', 'px'}, default='res'
|
|
3679
|
+
Unit for the width of the boxplot.
|
|
3680
|
+
Possible values:
|
|
3681
|
+
|
|
3682
|
+
- 'res': value 1 corresponds to the resolution along the x-axis, i.e. the minimum distance between data points;
|
|
3683
|
+
- 'identity': value 1 corresponds to the distance from 0 to 1 on the x-axis;
|
|
3684
|
+
- 'size': value 1 corresponds to the diameter of a point of size 1;
|
|
3685
|
+
- 'px': value 1 corresponds to 1 pixel.
|
|
3686
|
+
|
|
3612
3687
|
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
3613
3688
|
Define the color aesthetic for the geometry.
|
|
3614
3689
|
fill_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='fill'
|
|
@@ -3746,6 +3821,7 @@ def geom_boxplot(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
3746
3821
|
fatten=fatten,
|
|
3747
3822
|
varwidth=varwidth,
|
|
3748
3823
|
whisker_width=whisker_width,
|
|
3824
|
+
width_unit=width_unit,
|
|
3749
3825
|
color_by=color_by, fill_by=fill_by,
|
|
3750
3826
|
**other_args)
|
|
3751
3827
|
if stat is None or stat == 'boxplot':
|
|
@@ -4820,7 +4896,7 @@ def geom_density(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
4820
4896
|
|
|
4821
4897
|
.. jupyter-execute::
|
|
4822
4898
|
:linenos:
|
|
4823
|
-
:emphasize-lines: 11
|
|
4899
|
+
:emphasize-lines: 10-11
|
|
4824
4900
|
|
|
4825
4901
|
import numpy as np
|
|
4826
4902
|
from lets_plot import *
|
|
@@ -4837,14 +4913,13 @@ def geom_density(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
4837
4913
|
for bw in bandwidths
|
|
4838
4914
|
for n in sample_sizes
|
|
4839
4915
|
]
|
|
4840
|
-
|
|
4841
4916
|
gggrid(plots, ncol=3) + ggsize(900, 600)
|
|
4842
4917
|
|
|
4843
4918
|
|
|
|
4844
4919
|
|
|
4845
4920
|
.. jupyter-execute::
|
|
4846
4921
|
:linenos:
|
|
4847
|
-
:emphasize-lines: 10-
|
|
4922
|
+
:emphasize-lines: 10-12
|
|
4848
4923
|
|
|
4849
4924
|
import numpy as np
|
|
4850
4925
|
from lets_plot import *
|
|
@@ -4855,12 +4930,12 @@ def geom_density(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
4855
4930
|
p = ggplot({'x': x, 'y': y}, aes(x='x'))
|
|
4856
4931
|
adjustments = [0.5 * (1 + i) for i in range(3)]
|
|
4857
4932
|
plots = [
|
|
4858
|
-
p + geom_density(
|
|
4933
|
+
p + geom_density(
|
|
4934
|
+
aes(weight='y'),
|
|
4859
4935
|
kernel='cosine', adjust=adjust
|
|
4860
4936
|
) + ggtitle(f'adjust={adjust}')
|
|
4861
4937
|
for adjust in adjustments
|
|
4862
4938
|
]
|
|
4863
|
-
|
|
4864
4939
|
gggrid(plots) + ggsize(800, 200)
|
|
4865
4940
|
|
|
4866
4941
|
"""
|
|
@@ -4894,10 +4969,6 @@ def geom_density2d(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
4894
4969
|
"""
|
|
4895
4970
|
Display density function contour.
|
|
4896
4971
|
|
|
4897
|
-
By default, this geom uses `coord_fixed()`.
|
|
4898
|
-
However, this may not be the best choice when the values on the X/Y axis have significantly different magnitudes.
|
|
4899
|
-
In such cases, try using `coord_cartesian()`.
|
|
4900
|
-
|
|
4901
4972
|
Parameters
|
|
4902
4973
|
----------
|
|
4903
4974
|
mapping : `FeatureSpec`
|
|
@@ -5021,7 +5092,7 @@ def geom_density2d(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
5021
5092
|
|
|
5022
5093
|
.. jupyter-execute::
|
|
5023
5094
|
:linenos:
|
|
5024
|
-
:emphasize-lines:
|
|
5095
|
+
:emphasize-lines: 12-14
|
|
5025
5096
|
|
|
5026
5097
|
import numpy as np
|
|
5027
5098
|
from lets_plot import *
|
|
@@ -5034,20 +5105,20 @@ def geom_density2d(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
5034
5105
|
bandwidths = [0.2, 0.4]
|
|
5035
5106
|
sample_sizes = [16, 256]
|
|
5036
5107
|
plots = [
|
|
5037
|
-
p + geom_density2d(
|
|
5038
|
-
|
|
5108
|
+
p + geom_density2d(
|
|
5109
|
+
kernel='epanechikov',
|
|
5110
|
+
bw=bw, n=n
|
|
5039
5111
|
) + ggtitle(f'bw={bw}, n={n}')
|
|
5040
5112
|
for bw in bandwidths
|
|
5041
5113
|
for n in sample_sizes
|
|
5042
5114
|
]
|
|
5043
|
-
|
|
5044
5115
|
gggrid(plots, ncol=2) + ggsize(600, 650)
|
|
5045
5116
|
|
|
5046
5117
|
|
|
|
5047
5118
|
|
|
5048
5119
|
.. jupyter-execute::
|
|
5049
5120
|
:linenos:
|
|
5050
|
-
:emphasize-lines:
|
|
5121
|
+
:emphasize-lines: 12-15
|
|
5051
5122
|
|
|
5052
5123
|
import numpy as np
|
|
5053
5124
|
from lets_plot import *
|
|
@@ -5060,14 +5131,14 @@ def geom_density2d(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
5060
5131
|
adjustments = [1.5, 2.5]
|
|
5061
5132
|
bin_counts = [5, 15]
|
|
5062
5133
|
plots = [
|
|
5063
|
-
p + geom_density2d(
|
|
5134
|
+
p + geom_density2d(
|
|
5135
|
+
kernel='cosine',
|
|
5064
5136
|
adjust=adjust,
|
|
5065
5137
|
bins=bins
|
|
5066
5138
|
) + ggtitle(f'adjust={adjust}, bins={bins}')
|
|
5067
5139
|
for adjust in adjustments
|
|
5068
5140
|
for bins in bin_counts
|
|
5069
5141
|
]
|
|
5070
|
-
|
|
5071
5142
|
gggrid(plots, ncol=2) + ggsize(600, 650)
|
|
5072
5143
|
|
|
5073
5144
|
|
|
|
@@ -5085,7 +5156,7 @@ def geom_density2d(mapping=None, *, data=None, stat=None, position=None, show_le
|
|
|
5085
5156
|
y = np.random.normal(size=n)
|
|
5086
5157
|
ggplot({'x': x, 'y': y}, aes('x', 'y')) + \\
|
|
5087
5158
|
geom_raster(aes(fill='..density..'), \\
|
|
5088
|
-
|
|
5159
|
+
stat='density2d', contour=False, n=50) + \\
|
|
5089
5160
|
scale_fill_gradient(low='#49006a', high='#fff7f3')
|
|
5090
5161
|
|
|
5091
5162
|
|
|
|
@@ -5134,10 +5205,6 @@ def geom_density2df(mapping=None, *, data=None, stat=None, position=None, show_l
|
|
|
5134
5205
|
"""
|
|
5135
5206
|
Fill density function contour.
|
|
5136
5207
|
|
|
5137
|
-
By default, this geom uses `coord_fixed()`.
|
|
5138
|
-
However, this may not be the best choice when the values on the X/Y axis have significantly different magnitudes.
|
|
5139
|
-
In such cases, try using `coord_cartesian()`.
|
|
5140
|
-
|
|
5141
5208
|
Parameters
|
|
5142
5209
|
----------
|
|
5143
5210
|
mapping : `FeatureSpec`
|
|
@@ -5255,7 +5322,7 @@ def geom_density2df(mapping=None, *, data=None, stat=None, position=None, show_l
|
|
|
5255
5322
|
|
|
5256
5323
|
.. jupyter-execute::
|
|
5257
5324
|
:linenos:
|
|
5258
|
-
:emphasize-lines:
|
|
5325
|
+
:emphasize-lines: 12-15
|
|
5259
5326
|
|
|
5260
5327
|
import numpy as np
|
|
5261
5328
|
from lets_plot import *
|
|
@@ -5268,8 +5335,10 @@ def geom_density2df(mapping=None, *, data=None, stat=None, position=None, show_l
|
|
|
5268
5335
|
bandwidths = [0.2, 0.4]
|
|
5269
5336
|
sample_sizes = [16, 256]
|
|
5270
5337
|
plots = [
|
|
5271
|
-
p + geom_density2df(
|
|
5272
|
-
|
|
5338
|
+
p + geom_density2df(
|
|
5339
|
+
kernel='epanechikov',
|
|
5340
|
+
size=.5, color='white',
|
|
5341
|
+
bw=bw, n=n
|
|
5273
5342
|
) + ggtitle(f'bw={bw}, n={n}')
|
|
5274
5343
|
for bw in bandwidths
|
|
5275
5344
|
for n in sample_sizes
|
|
@@ -5280,7 +5349,7 @@ def geom_density2df(mapping=None, *, data=None, stat=None, position=None, show_l
|
|
|
5280
5349
|
|
|
5281
5350
|
.. jupyter-execute::
|
|
5282
5351
|
:linenos:
|
|
5283
|
-
:emphasize-lines: 12-
|
|
5352
|
+
:emphasize-lines: 12-15
|
|
5284
5353
|
|
|
5285
5354
|
import numpy as np
|
|
5286
5355
|
from lets_plot import *
|
|
@@ -5293,14 +5362,14 @@ def geom_density2df(mapping=None, *, data=None, stat=None, position=None, show_l
|
|
|
5293
5362
|
adjustments = [1.5, 2.5]
|
|
5294
5363
|
bin_counts = [5, 15]
|
|
5295
5364
|
plots = [
|
|
5296
|
-
p + geom_density2df(
|
|
5365
|
+
p + geom_density2df(
|
|
5366
|
+
kernel='cosine', size=.5, color='white',
|
|
5297
5367
|
adjust=adjust,
|
|
5298
5368
|
bins=bins
|
|
5299
5369
|
) + ggtitle(f'adjust={adjust}, bins={bins}')
|
|
5300
5370
|
for adjust in adjustments
|
|
5301
5371
|
for bins in bin_counts
|
|
5302
5372
|
]
|
|
5303
|
-
|
|
5304
5373
|
gggrid(plots, ncol=2) + ggsize(600, 650)
|
|
5305
5374
|
|
|
5306
5375
|
|
|
|
@@ -6482,7 +6551,7 @@ def geom_segment(mapping=None, *, data=None, stat=None, position=None, show_lege
|
|
|
6482
6551
|
geodesic : bool, default=False
|
|
6483
6552
|
Draw geodesic. Coordinates expected to be in WGS84. Works only with `geom_livemap()`.
|
|
6484
6553
|
spacer : float, default=0.0
|
|
6485
|
-
|
|
6554
|
+
Pixels to shorten segment, creating gaps at start/end points.
|
|
6486
6555
|
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
6487
6556
|
Define the color aesthetic for the geometry.
|
|
6488
6557
|
other_args
|
|
@@ -6649,7 +6718,7 @@ def geom_curve(mapping=None, *, data=None, stat=None, position=None, show_legend
|
|
|
6649
6718
|
ncp : int, default=5
|
|
6650
6719
|
The number of control points used to draw the curve. More control points creates a smoother curve.
|
|
6651
6720
|
spacer : float, default=0.0
|
|
6652
|
-
|
|
6721
|
+
Pixels to shorten segment, creating gaps at start/end points.
|
|
6653
6722
|
color_by : {'fill', 'color', 'paint_a', 'paint_b', 'paint_c'}, default='color'
|
|
6654
6723
|
Define the color aesthetic for the geometry.
|
|
6655
6724
|
other_args
|
|
@@ -7385,6 +7454,7 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
7385
7454
|
hole=None,
|
|
7386
7455
|
stroke_side=None,
|
|
7387
7456
|
spacer_width=None, spacer_color=None,
|
|
7457
|
+
start=None, direction=None,
|
|
7388
7458
|
size_unit=None,
|
|
7389
7459
|
color_by=None, fill_by=None,
|
|
7390
7460
|
**other_args):
|
|
@@ -7442,10 +7512,15 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
7442
7512
|
stroke_side : {'outer', 'inner', 'both'}, default='both'
|
|
7443
7513
|
Define which arcs of pie sector should have a stroke.
|
|
7444
7514
|
spacer_width : float, default=0.75
|
|
7445
|
-
Line width between sectors.
|
|
7515
|
+
Line width between sectors in pixels.
|
|
7446
7516
|
Spacers are not applied to exploded sectors and to sides of adjacent sectors.
|
|
7447
7517
|
spacer_color : str
|
|
7448
7518
|
Color for spacers between sectors. By default, the "paper" color is used.
|
|
7519
|
+
start : float, default=None
|
|
7520
|
+
Specify the angle at which the first sector starts. Accept values between 0 and 360.
|
|
7521
|
+
Default is a negative angle of the first sector.
|
|
7522
|
+
direction : {1, -1}, default=1
|
|
7523
|
+
Specify angle direction, 1=clockwise, -1=counter-clockwise.
|
|
7449
7524
|
size_unit : {'x', 'y'}
|
|
7450
7525
|
Relate the size of the pie chart to the length of the unit step along one of the axes.
|
|
7451
7526
|
If None, no fitting is performed.
|
|
@@ -7625,6 +7700,7 @@ def geom_pie(mapping=None, *, data=None, stat=None, position=None, show_legend=N
|
|
|
7625
7700
|
stroke_side=stroke_side,
|
|
7626
7701
|
spacer_width=spacer_width,
|
|
7627
7702
|
spacer_color=spacer_color,
|
|
7703
|
+
start=start, direction=direction,
|
|
7628
7704
|
size_unit=size_unit,
|
|
7629
7705
|
color_by=color_by, fill_by=fill_by,
|
|
7630
7706
|
**other_args)
|
lets_plot/plot/pos.py
CHANGED
|
@@ -146,7 +146,7 @@ def position_jitter(width=None, height=None, seed=None):
|
|
|
146
146
|
return _pos('jitter', width=width, height=height, seed=seed)
|
|
147
147
|
|
|
148
148
|
|
|
149
|
-
def position_nudge(x=None, y=None):
|
|
149
|
+
def position_nudge(x=None, y=None, unit=None):
|
|
150
150
|
"""
|
|
151
151
|
Adjust position by nudging a given offset.
|
|
152
152
|
|
|
@@ -156,6 +156,8 @@ def position_nudge(x=None, y=None):
|
|
|
156
156
|
Nudging width.
|
|
157
157
|
y : float
|
|
158
158
|
Nudging height.
|
|
159
|
+
unit : {'identity', 'size', 'px'}
|
|
160
|
+
Units for x and y nudging.
|
|
159
161
|
|
|
160
162
|
Returns
|
|
161
163
|
-------
|
|
@@ -182,10 +184,10 @@ def position_nudge(x=None, y=None):
|
|
|
182
184
|
t = np.random.choice(list('abcdefghijk'), size=n)
|
|
183
185
|
ggplot({'x': x, 'y': y, 't': t}, aes('x', 'y')) + \\
|
|
184
186
|
geom_point(size=5, shape=21, color='black', fill='red') + \\
|
|
185
|
-
geom_text(aes(label='t'), position=position_nudge(y=.05))
|
|
187
|
+
geom_text(aes(label='t'), position=position_nudge(y=.05, unit='identity'))
|
|
186
188
|
|
|
187
189
|
"""
|
|
188
|
-
return _pos('nudge', x=x, y=y)
|
|
190
|
+
return _pos('nudge', x=x, y=y, unit=unit)
|
|
189
191
|
|
|
190
192
|
|
|
191
193
|
def position_jitterdodge(dodge_width=None, jitter_width=None, jitter_height=None, seed=None):
|
lets_plot/plot/scale.py
CHANGED
|
@@ -741,18 +741,18 @@ def scale_continuous(aesthetic, *,
|
|
|
741
741
|
|
|
742
742
|
.. jupyter-execute::
|
|
743
743
|
:linenos:
|
|
744
|
-
:emphasize-lines:
|
|
744
|
+
:emphasize-lines: 9
|
|
745
745
|
|
|
746
746
|
from lets_plot import *
|
|
747
747
|
LetsPlot.setup_html()
|
|
748
|
-
|
|
749
|
-
d = {
|
|
748
|
+
data = {
|
|
750
749
|
'x': [0, 1, 2],
|
|
751
750
|
'y': [0, 1, 2]
|
|
752
751
|
}
|
|
753
|
-
ggplot(
|
|
752
|
+
ggplot(data) + \\
|
|
754
753
|
geom_point(aes(x='x', y='y'), size=15) + \\
|
|
755
754
|
scale_continuous(['x','y'], expand=[0, 0]) # no expansion - points right on the edges
|
|
755
|
+
|
|
756
756
|
"""
|
|
757
757
|
if _is_color_scale(aesthetic):
|
|
758
758
|
scale_mapper_kind = 'color_gradient' if scale_mapper_kind is None else scale_mapper_kind
|
|
@@ -2027,18 +2027,18 @@ def scale_discrete(aesthetic, *,
|
|
|
2027
2027
|
|
|
2028
2028
|
.. jupyter-execute::
|
|
2029
2029
|
:linenos:
|
|
2030
|
-
:emphasize-lines:
|
|
2030
|
+
:emphasize-lines: 9
|
|
2031
2031
|
|
|
2032
2032
|
from lets_plot import *
|
|
2033
2033
|
LetsPlot.setup_html()
|
|
2034
|
-
|
|
2035
|
-
d = {
|
|
2034
|
+
data = {
|
|
2036
2035
|
'x': [0, 1, 2],
|
|
2037
2036
|
'y': [0, 1, 2]
|
|
2038
2037
|
}
|
|
2039
|
-
ggplot(
|
|
2038
|
+
ggplot(data) + \\
|
|
2040
2039
|
geom_point(aes(x='x', y='y'), size=15) + \\
|
|
2041
2040
|
scale_discrete(['x','y'], expand=[0, 0]) # no expansion - points right on the edges
|
|
2041
|
+
|
|
2042
2042
|
"""
|
|
2043
2043
|
return _scale(aesthetic=aesthetic,
|
|
2044
2044
|
name=name,
|
lets_plot/plot/theme_.py
CHANGED
|
@@ -10,6 +10,7 @@ __all__ = [
|
|
|
10
10
|
"element_line",
|
|
11
11
|
'element_rect',
|
|
12
12
|
'element_text',
|
|
13
|
+
'element_markdown',
|
|
13
14
|
'margin',
|
|
14
15
|
'element_geom',
|
|
15
16
|
]
|
|
@@ -48,12 +49,11 @@ def theme(*,
|
|
|
48
49
|
legend_key_size=None, legend_key_width=None, legend_key_height=None,
|
|
49
50
|
legend_key_spacing=None, legend_key_spacing_x=None, legend_key_spacing_y=None,
|
|
50
51
|
legend_box=None, legend_box_just=None, legend_box_spacing=None,
|
|
51
|
-
|
|
52
|
+
legend_ticks=None, legend_ticks_length=None,
|
|
52
53
|
|
|
53
54
|
panel_background=None,
|
|
54
55
|
panel_border=None,
|
|
55
56
|
panel_border_ontop=None,
|
|
56
|
-
# ToDo: other panel options...
|
|
57
57
|
|
|
58
58
|
panel_grid=None,
|
|
59
59
|
panel_grid_ontop=None,
|
|
@@ -221,6 +221,14 @@ def theme(*,
|
|
|
221
221
|
Justification of each legend within the overall bounding box, when there are multiple legends.
|
|
222
222
|
legend_box_spacing : float
|
|
223
223
|
Spacing between plotting area and legend box.
|
|
224
|
+
legend_ticks : str or dict
|
|
225
|
+
Tick marks in colorbars.
|
|
226
|
+
Set 'blank' or result of `element_blank()` to draw nothing and assign no space.
|
|
227
|
+
Set `element_line()` to specify all tick mark parameters.
|
|
228
|
+
`legend_ticks_*` DOES NOT inherit from `line`.
|
|
229
|
+
By default, the colorbar tick marks are drawn with the same color as the colorbar background.
|
|
230
|
+
legend_ticks_length : float
|
|
231
|
+
Length of colorbar tick marks in px.
|
|
224
232
|
panel_background : str or dict
|
|
225
233
|
Background of plotting area.
|
|
226
234
|
Set 'blank' or result of `element_blank()` to draw nothing.
|
|
@@ -628,6 +636,83 @@ def element_text(
|
|
|
628
636
|
return locals()
|
|
629
637
|
|
|
630
638
|
|
|
639
|
+
def element_markdown(
|
|
640
|
+
color=None,
|
|
641
|
+
family=None,
|
|
642
|
+
face=None,
|
|
643
|
+
size=None,
|
|
644
|
+
angle=None,
|
|
645
|
+
# ToDo: lineheight
|
|
646
|
+
hjust=None,
|
|
647
|
+
vjust=None,
|
|
648
|
+
margin=None,
|
|
649
|
+
blank=False,
|
|
650
|
+
) -> dict:
|
|
651
|
+
"""
|
|
652
|
+
Specify how non-data components of the plot are drawn.
|
|
653
|
+
This theme element draws texts with Markdown support.
|
|
654
|
+
|
|
655
|
+
Parameters
|
|
656
|
+
----------
|
|
657
|
+
color : str
|
|
658
|
+
Text color.
|
|
659
|
+
family : str
|
|
660
|
+
Font family.
|
|
661
|
+
face : str
|
|
662
|
+
Font face ("plain", "italic", "bold", "bold_italic").
|
|
663
|
+
size : int
|
|
664
|
+
Text size in px.
|
|
665
|
+
angle : float
|
|
666
|
+
Angle to rotate the text (in degrees).
|
|
667
|
+
hjust : float
|
|
668
|
+
Horizontal justification (in [0, 1]).
|
|
669
|
+
0 - left-justified;
|
|
670
|
+
1 - right-justified;
|
|
671
|
+
0.5 - center-justified.
|
|
672
|
+
Can be used with values out of range, but behaviour is not specified.
|
|
673
|
+
vjust : float
|
|
674
|
+
Vertical justification (in [0, 1]).
|
|
675
|
+
0 - bottom-justified;
|
|
676
|
+
1 - top-justified;
|
|
677
|
+
0.5 - middle-justified.
|
|
678
|
+
Can be used with values out of range, but behaviour is not specified.
|
|
679
|
+
margin : number or list of numbers
|
|
680
|
+
Margins around the text.
|
|
681
|
+
|
|
682
|
+
The margin may be specified using a number or a list of numbers:
|
|
683
|
+
- a number or list of one number - the same margin it applied to all four sides;
|
|
684
|
+
- a list of two numbers - the first margin applies to the top and bottom, the second - to the left and right;
|
|
685
|
+
- a list of three numbers - the first margin applies to the top, the second - to the right and left,
|
|
686
|
+
the third - to the bottom;
|
|
687
|
+
- a list of four numbers - the margins are applied to the top, right, bottom and left in that order.
|
|
688
|
+
|
|
689
|
+
It is acceptable to use None for any side; in this case, the default side value for this element will be used.
|
|
690
|
+
blank : bool, default=False
|
|
691
|
+
If True - draws nothing, and assigns no space.
|
|
692
|
+
|
|
693
|
+
Returns
|
|
694
|
+
-------
|
|
695
|
+
`dict`
|
|
696
|
+
Theme element specification.
|
|
697
|
+
|
|
698
|
+
Examples
|
|
699
|
+
--------
|
|
700
|
+
.. jupyter-execute::
|
|
701
|
+
:linenos:
|
|
702
|
+
:emphasize-lines: 7
|
|
703
|
+
|
|
704
|
+
import numpy as np
|
|
705
|
+
from lets_plot import *
|
|
706
|
+
LetsPlot.setup_html()
|
|
707
|
+
np.random.seed(42)
|
|
708
|
+
data = {'x': np.random.normal(size=1000)}
|
|
709
|
+
ggplot(data, aes(x='x')) + geom_histogram() + \\
|
|
710
|
+
theme(axis_text=element_text(color='#cb181d', face='bold_italic', margin=[5, 10]))
|
|
711
|
+
|
|
712
|
+
"""
|
|
713
|
+
return {'markdown': True, **locals()}
|
|
714
|
+
|
|
715
|
+
|
|
631
716
|
def margin(t=None, r=None, b=None, l=None):
|
|
632
717
|
"""
|
|
633
718
|
Function `margin()` is deprecated.
|