Lifemap.layer_points
Lifemap.layer_points(
leaves='show',
radius=5,
radius_range=(2, 30),
fill=None,
fill_cat=None,
scheme=None,
opacity=0.8,
popup=True,
hover=None,
label=None,
)Add a points layer.
It can be used to display leaves values, or aggregated counts or values already computed or generated by aggregate_num or aggregate_count.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| leaves | Literal["show", "only", "omit"] | If "only", only show tree leaves. If "omit", only show nodes that are not leaves. If "show", show all nodes, by default “show” |
'show' |
| radius | int | float | str | If numeric, the fixed radius of the points. If a string, the name of a numerical DataFrame column to compute radius width from. | 5 |
| radius_range | tuple | list | Range of values for points radius, only used if radius_col is not None, by default (2, 30) | (2, 30) |
| fill | str | None | Either the name of a numerical DataFrame column to determine points color, or a fixed CSS color for points. | None |
| fill_cat | bool | None | If True, force color scheme to be categorical. If False, force it to be continuous. If None, let pylifemap decide. By default None. | None |
| scheme | str | None | Color scheme for points color. It is the name of an Observable Plot color scale. | None |
| opacity | float | Points opacity as a floating number between 0 and 1, by default 0.8 | 0.8 |
| popup | bool | If True, display informations in a popup when a point is clicked, by default False | True |
| hover | bool | None | If True, highlight points on mouse hovering. By default True if less than 10_000 data points, False otherwise. | None |
| label | str | None | Legend title for this layer if fill is defined. If None, the value of fill is used. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| Lifemap | A Lifemap visualization object. |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If leaves is not one of the allowed values. |
Examples
>>> import polars as pl
>>> from pylifemap import Lifemap
>>> d = pl.DataFrame(
... {
... "taxid": [
... 9685,
... 9615,
... 9994,
... 2467430,
... 2514524,
... 2038938,
... 1021470,
... 1415565,
... 1928562,
... 1397240,
... 230741,
... ],
... "value": [7.4, 2.5, 8.3, 1.0, 1.4, 5.6, 4.6, 3.4, 2.3, 2.8, 3.1],
... }
... )
>>> Lifemap(d).layer_points(radius="value", fill="value", popup=True).show()See also
aggregate_num : aggregation of a numeric variable.
aggregate_count : aggregation of the number of observations.