Donuts layer

The donuts layer displays aggregated levels count of a categorical variable as donut charts, optionally displayng the individual values with points.

import polars as pl
from pylifemap import Lifemap, aggregate_freq

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

# Aggregate observations count along branches
iucn_freq = aggregate_freq(iucn, column="status")

(
    Lifemap(iucn_freq)
    .layer_donuts(counts_col="status", opacity=1, leaves="show")
    .show()
)
/home/runner/work/pylifemap/pylifemap/src/pylifemap/data.py:98: UserWarning: 4 taxids have not been found in Lifemap database: [None, 210648, 303018, 1221133]
  warnings.warn(msg, stacklevel=0)
/home/runner/work/pylifemap/pylifemap/src/pylifemap/data.py:110: UserWarning: 9994 duplicated taxids have been found in the data
  warnings.warn(msg, stacklevel=0)

The leaves argument allows to "show" or "hide" individual leaves values.

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