Lifemap.layer_lines

Lifemap.layer_lines(
    width=3,
    width_range=(1, 30),
    color=None,
    scheme=None,
    opacity=0.8,
    popup=True,
    hover=True,
    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 int | float | str If numeric, the fixed width of the lines. If a string, the name of a numerical DataFrame column to compute line width from. 3
width_range tuple | list Min and max values for line widths, only used if width is a data column, by default (1, 30) (1, 30)
color str | None Either the name of a numerical DataFrame column to determine line color, or a fixed CSS color for lines. None
scheme str | None Color scheme for lines color. It is the name of an Observable Plot color scale. None
opacity float Line 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 If True, highlight points on mouse hovering. By default False. True
label str | None Legend title for this layer if color_col is defined. If None, the value of color_col is used. None

Returns

Name 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.