From b7e1f3eb1e296adde6464bc9381323d35ce25575 Mon Sep 17 00:00:00 2001 From: Carl Buchholz <32228189+aGuyLearning@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:06:20 +0100 Subject: [PATCH] Rename display_table parameter to display_survival_statistics in kaplan_meier function and update related tests --- ehrapy/plot/_survival_analysis.py | 6 +++--- tests/_scripts/kaplain_meier_create_expected_plots.ipynb | 2 +- tests/plot/test_survival_analysis.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ehrapy/plot/_survival_analysis.py b/ehrapy/plot/_survival_analysis.py index e3d2ae6b..51ca9d11 100644 --- a/ehrapy/plot/_survival_analysis.py +++ b/ehrapy/plot/_survival_analysis.py @@ -186,7 +186,7 @@ def kmf( def kaplan_meier( kmfs: Sequence[KaplanMeierFitter], *, - display_table: bool = False, + display_survival_statistics: bool = False, ci_alpha: list[float] | None = None, ci_force_lines: list[Boolean] | None = None, ci_show: list[Boolean] | None = None, @@ -208,7 +208,7 @@ def kaplan_meier( Args: kmfs: Iterables of fitted KaplanMeierFitter objects. - display_table: Display the survival probabilities in a table, below the plot. + display_survival_statistics: Display survival statistics in a table below the plot. ci_alpha: The transparency level of the confidence interval. If more than one kmfs, this should be a list. ci_force_lines: Force the confidence intervals to be line plots (versus default shaded areas). If more than one kmfs, this should be a list. @@ -302,7 +302,7 @@ def kaplan_meier( ax.set_title(title) # Prepare data for the table - if display_table: + if display_survival_statistics: xticks = [x for x in ax.get_xticks() if x >= 0] xticks_space = xticks[1] - xticks[0] if xlabel is None: diff --git a/tests/_scripts/kaplain_meier_create_expected_plots.ipynb b/tests/_scripts/kaplain_meier_create_expected_plots.ipynb index 401bf639..b5bff552 100644 --- a/tests/_scripts/kaplain_meier_create_expected_plots.ipynb +++ b/tests/_scripts/kaplain_meier_create_expected_plots.ipynb @@ -79,7 +79,7 @@ " ylim=[0, 1],\n", " xlabel=\"Days\",\n", " ylabel=\"Proportion Survived\",\n", - " display_table=True,\n", + " display_survival_statistics=True,\n", " grid=True,\n", ")" ] diff --git a/tests/plot/test_survival_analysis.py b/tests/plot/test_survival_analysis.py index 782f63b1..6653db4d 100644 --- a/tests/plot/test_survival_analysis.py +++ b/tests/plot/test_survival_analysis.py @@ -40,7 +40,7 @@ def test_kaplan_meier(mimic_2, check_same_image): xlabel="Days", ylabel="Proportion Survived", grid=True, - display_table=True, + display_survival_statistics=True, ) check_same_image(