Do not attempt to draw legend on survival curves if only one curve
This commit is contained in:
parent
8238383edb
commit
ae1a4cb5b8
@ -80,6 +80,8 @@ def kaplanmeier(df, time, status, by=None, *, ci=True, transform_x=None, transfo
|
|||||||
ax.set_ylabel('Survival probability ({:.0%} CI)'.format(1-config.alpha) if ci else 'Survival probability')
|
ax.set_ylabel('Survival probability ({:.0%} CI)'.format(1-config.alpha) if ci else 'Survival probability')
|
||||||
ax.set_xlim(left=0)
|
ax.set_xlim(left=0)
|
||||||
ax.set_ylim(0, 1)
|
ax.set_ylim(0, 1)
|
||||||
|
|
||||||
|
if by is not None:
|
||||||
ax.legend()
|
ax.legend()
|
||||||
|
|
||||||
return fig, ax
|
return fig, ax
|
||||||
@ -174,6 +176,8 @@ def turnbull(df, time_left, time_right, by=None, *, step_loc=0.5, transform_x=No
|
|||||||
ax.set_ylabel('Survival probability')
|
ax.set_ylabel('Survival probability')
|
||||||
ax.set_xlim(left=0)
|
ax.set_xlim(left=0)
|
||||||
ax.set_ylim(0, 1)
|
ax.set_ylim(0, 1)
|
||||||
|
|
||||||
|
if by is not None:
|
||||||
ax.legend()
|
ax.legend()
|
||||||
|
|
||||||
return fig, ax
|
return fig, ax
|
||||||
|
Loading…
Reference in New Issue
Block a user