0

I do not know how I can modify the output image provide by lifelines since I am unfamiliar with "cph.plot_covariate_groups". Unfortunately, there seems no detailed description about it in the link here; https://lifelines.readthedocs.io/en/latest/Survival%20Regression.html .

What I am looking for is, (1) how to shorten the event days (X axis), I do not want to show such a long days for the survival curve. Ideally, 4000 is the best. (2) Also, if possible, I would like to remove the baseline survival curve from my image. (3) I am also hoping if I could change the color of the survival curves from orange/blue to others.

import pandas as pd
from lifelines import AalenAdditiveFitter, CoxPHFitter, KaplanMeierFitter

data =  pd.read_csv("cluster label.csv", index_col=0)
cph = CoxPHFitter()
cph.fit(data, duration_col="time", event_col="status")
cph.plot_covariate_groups('label', [0,1])

enter image description here

1 Answers1

0

This is all possible. Information about specific functions and methods are available on the docs page: https://lifelines.readthedocs.io/en/latest/References.html

Specifically: https://lifelines.readthedocs.io/en/latest/lifelines.fitters.html#lifelines.fitters.coxph_fitter.CoxPHFitter.plot_covariate_groups

So try this:

cph.plot_covariate_groups('label', [0,1], 
   plot_baseline=False, 
   cmap='coolwarm'
)
plt.xlim(0, 4000)
Cam.Davidson.Pilon
  • 1,606
  • 1
  • 17
  • 31