Lifemap.layer_lines

Lifemap.layer_lines(width=None, width_col=None, color_col=None, scheme=None, opacity=0.8, popup=False, label=None)

Add a lines layer.

This layer can be applied to data generated by aggregate_num or aggregate_count.

Parameters

Name Type Description Default
width float | None Base line width, by default None None
width_col str | None Name of numeric DataFrame column to compute line width, by default None None
color_col str | None Name of numeric DataFrame column to determine line color, by default None None
scheme str | None Color scheme for points color. If color_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 Line opacity as a floating number between 0 and 1, by default 0.8 0.8
popup bool | None TODO: doesn’t work for the moment. 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 color_col is defined. If None, the value of color_col is used. None

Returns

Type Description
Lifemap A Lifemap visualization object.

Examples

>>> import polars as pl
>>> from pylifemap import Lifemap, aggregate_num
>>> 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]
... })
>>> d = aggregate_num(d, column="value", fn="mean")
>>> (
...     Lifemap(d)
...     .layer_lines(width_col="value", color_col="value")
...     .show()
... )

See Also

aggregate_num : aggregation of a numeric variable.

aggregate_count : aggregation of the number of observations.