Lifemap.layer_points

Lifemap.layer_points(
    leaves='show',
    radius=None,
    radius_col=None,
    fill_col=None,
    fill_col_cat=None,
    scheme=None,
    opacity=0.8,
    popup=False,
    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 float | None Base points radius, by default None None
radius_col str | None Name of a numeric DataFrame column to compute points radius, by default None None
fill_col str | None Name of a DataFrame column to determine points color, by default None None
fill_col_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. If fill_col is defined, it is the name of an Observable Plot color scale. Otherwise, it is an hexadecimal color value, by default None None
opacity float | None Points opacity as a floating number between 0 and 1, by default 0.8 0.8
popup bool | None If True, display informations in a popup when a point is clicked, by default False False
label str | None Legend title for this layer if fill_col is defined. If None, the value of fill_col 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_col="value", fill_col="value", popup=True).show())

See also

aggregate_num : aggregation of a numeric variable.

aggregate_count : aggregation of the number of observations.