statsmodels.duration.survfunc.SurvfuncRight.plot#

SurvfuncRight.plot(ax=None)[source]#

Plot the survival function

Parameters:
axAxesSubplot, optional

An axes on which to draw the graph. If None, new figure and axes objects are created.

Returns:
Figure

The figure on which the plot is drawn.

Examples

Change the line color:

>>> import statsmodels.api as sm
>>> data = sm.datasets.get_rdataset("flchain", "survival").data
>>> df = data.loc[data.sex == "F", :]
>>> sf = sm.SurvfuncRight(df["futime"], df["death"])
>>> fig = sf.plot()
>>> ax = fig.get_axes()[0]
>>> li = ax.get_lines()
>>> li[0].set_color('purple')
>>> li[1].set_color('purple')

Do not show the censoring points:

>>> fig = sf.plot()
>>> ax = fig.get_axes()[0]
>>> li = ax.get_lines()
>>> li[1].set_visible(False)