From c0e9b49816c8212dcacaadcc9b425f5897235897 Mon Sep 17 00:00:00 2001 From: Carl Buchholz <32228189+aGuyLearning@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:49:41 +0100 Subject: [PATCH] Enhance documentation for cox_ph_forestplot function to clarify usage of adata and summary table --- ehrapy/plot/_survival_analysis.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ehrapy/plot/_survival_analysis.py b/ehrapy/plot/_survival_analysis.py index 6c21b781..febefa4f 100644 --- a/ehrapy/plot/_survival_analysis.py +++ b/ehrapy/plot/_survival_analysis.py @@ -318,14 +318,17 @@ def cox_ph_forestplot( title: str | None = None, ): """Generates a forest plot to visualize the coefficients and confidence intervals of a Cox Proportional Hazards model. - The adata object must be populated via the :func:`~ehrapy.tools.cox_ph` function beforehand. + + The `adata` object must first be populated using the :func:`~ehrapy.tools.cox_ph` function. This function stores the summary table of the `CoxPHFitter` in the `.uns` attribute of `adata`. + The summary table is created when the model is fitted using the :func:`ehrapy.tl.cox_ph` function. + For more information on the `CoxPHFitter`, see the `Lifelines documentation `_. Inspired by `zepid.graphics.EffectMeasurePlot `_ (zEpid Package, https://pypi.org/project/zepid/). Args: - adata: :class:`~anndata.AnnData` object containing the summary table from the CoxPHFitter. This object is populated using the :func:`~ehrapy.tools.cox_ph` function. - uns_key: Key in `.uns` where the CoxPHFitter object is stored. - labels: List of labels for each coefficient, default uses the index of the coxph.summary. + adata: :class:`~anndata.AnnData` object containing the summary table from the CoxPHFitter. This is stored in the `.uns` attribute, after fitting the model using :func:`~ehrapy.tl.cox_ph`. + uns_key: Key in `.uns` where :func:`~ehrapy.tools.cox_ph` function stores the summary table. + labels: List of labels for each coefficient, default uses the index of the summary ta fig_size: Width, height in inches. t_adjuster: Adjust the table to the right. ecolor: Color of the error bars.