risk_table()

Return the numbers-at-risk table as a standalone Altair chart.

Usage

Source

risk_table(
    km,
    times=None,
)

Examples

import greenwood as gw

lung = gw.load_dataset("lung", backend="polars")
y = gw.Surv.right(lung["time"], event=(lung["status"] == 2))
km = gw.KaplanMeier().fit(y, by=lung["sex"])

gw.viz.altair.risk_table(km, times=[0, 250, 500, 750, 1000])