plot_risk_triptych

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

plot_risk_triptych(time: ndarray, event: ndarray, risk: ndarray, *, survival_probability: ndarray | None = None, survival_times: ndarray | None = None, time_label: str = 'Time', risk_label: str = 'Risk score')[source]

Three-panel risk-stratification figure.

Panel 1 ranks subjects by predicted risk and colours observed events; panel 2 overlays each subject’s predicted survival curve (when supplied) against the cohort KM curve; panel 3 shows each subject’s follow-up time and event status along the risk ranking. Together they show, at a glance, whether the score separates early events from long survivors.

Parameters:
  • time – Observed follow-up durations.

  • event – Event indicators, True for observed events.

  • risk – Per-subject risk scores (higher means shorter survival).

  • survival_probability – Optional (n_subjects, n_times) predicted S(t|x) matrix for panel 2.

  • survival_times – The times survival_probability columns align to.

  • time_label – X-axis label (sanitised).

  • risk_label – Risk-axis label (sanitised).

Returns:

The matplotlib Figure.