Lines layer

The lines layer displays aggregated observations (count or numerical variable) by highlighting branches of the tree.

The color and width arguments allow to modify the size and color of the lines. They can either be fixed values (numerical for width, an hexadecimal color code for color) or data column names. In this case, width or color will depend on the column values.

import polars as pl
from pylifemap import Lifemap, aggregate_count

# Load iucn dataset
iucn = pl.read_parquet(
    "https://raw.githubusercontent.com/Lifemap-ToL/pylifemap/main/data/iucn.parquet"
)

# Aggregate observations count along branches
iucn_agg = aggregate_count(iucn)

(
    Lifemap(iucn_agg)
    .layer_lines(color="n", width="n", opacity=0.6)
    .show()
)
Warning: 777 taxids have not been found in Lifemap database.

For a detailed list of layer_lines arguments you can take a look at its documentation.