I am learning survival analysis using the lifelines library. I am using the leukemia dataset. I was trying to plot the lifetimes plot. However, I am getting a plot which is upside down (i.e., flipped vertically).
I am using this notebook as a reference. This is my code:
import lifelines
import matplotlib.pyplot as plt
from lifelines.datasets import load_leukemia
leukemia = load_leukemia()
durations = leukemia.t.values
events = leukemia.status.values
ax = lifelines.plotting.plot_lifetimes(durations=durations, event_observed=events)
ax.set_xlim(0, 40)
ax.set_xlabel("Time in Months")
plt.plot()
This is the plot that I am getting
This is the plot that I want to generate: