Allow passing own fig, ax to yli.kaplanmeier

This commit is contained in:
RunasSudo 2023-10-20 21:11:35 +11:00
parent 26a6766f0e
commit 675422246f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -22,7 +22,7 @@ from .config import config
from .sig_tests import ChiSquaredResult from .sig_tests import ChiSquaredResult
from .utils import Estimate, check_nan from .utils import Estimate, check_nan
def kaplanmeier(df, time, status, by=None, *, ci=True, transform_x=None, transform_y=None, nan_policy='warn'): def kaplanmeier(df, time, status, by=None, *, ci=True, transform_x=None, transform_y=None, nan_policy='warn', fig=None, ax=None):
""" """
Generate a KaplanMeier plot Generate a KaplanMeier plot
@ -59,7 +59,8 @@ def kaplanmeier(df, time, status, by=None, *, ci=True, transform_x=None, transfo
# Covert timedelta to numeric # Covert timedelta to numeric
df, time_units = survtime_to_numeric(df, time) df, time_units = survtime_to_numeric(df, time)
fig, ax = plt.subplots() if ax is None:
fig, ax = plt.subplots()
if by is not None: if by is not None:
# Group by independent variable # Group by independent variable