Lifemap.layer_arcs_deck

Lifemap.layer_arcs_deck(
    data=None,
    *,
    taxid_col='taxid',
    taxid_dest_col,
    width=3,
    width_range=(1, 20),
    source_color=(255, 0, 0, 255),
    dest_color=(255, 255, 0, 255),
    height=0.2,
    tilt=15,
    n_segments=100,
    opacity=0.8,
)

Add an arcs layer.

Parameters

Name Type Description Default
data pl.DataFrame | pd.DataFrame | None Layer data. If not provided, use the base widget data. None
taxid_col str Name of the data column with arc start taxonomy ids. By default 'taxid'. 'taxid'
taxid_dest_col str Name of the data column with arc end taxonomy ids. required
width int | float | str If numeric, the fixed width of the arcs. If a string, the name of a numerical DataFrame column to compute arc width from. By default 3. 3
width_range tuple | list Min and max values for arcs widths, only used if width is a data column. By default (1, 30). (1, 20)
source_color Sequence Array of 4 numbers between 0 and 255 defining the start of arc color ([red, green, blue, opacity]). By default (255, 0, 0, 255). (255, 0, 0, 255)
dest_color Sequence Array of 4 numbers between 0 and 255 defining the end of arc color ([red, green, blue, opacity]). By default (255, 255, 0, 255). (255, 255, 0, 255)
height float Arcs height. By default 0.2. 0.2
tilt int Tilt angle for arcs with same source and destination. By default 15. 15
n_segments int Number of segments per arc. A bigger number gives smoother results but can be slower to render. By default 100. 100
opacity float Arc opacity as a floating number between 0 and 1. By default 0.8. 0.8

Returns

Name Type Description
Lifemap A Lifemap visualization object.

Examples

>>> import polars as pl
>>> from pylifemap import Lifemap
>>> d = pl.DataFrame(
...     {
...         "taxid": [
...             9685,
...             9615,
...             9994,
...             2467430,
...             2514524,
...             2038938,
...             1021470,
...             1415565,
...             1928562,
...             1397240,
...             230741,
...         ],
...         "dest_taxid": [
...             9615,
...             1415565,
...             2467430,
...             9994,
...             9685,
...             2514524,
...             2038938,
...             1397240,
...             1021470,
...             1928562,
...             230741,
...         ],
...     }
... )
Lifemap(d).layer_arcs_deck(taxid_dest_col="dest_taxid").show()