Skip to content

Commit

Permalink
fixing kmf plot
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jun 22, 2017
1 parent e7c967d commit 05242f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lifelines/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ def set_kwargs_color(kwargs):
if int(major_version) == 1 and int(minor_version) < 5:
raise ValueError('Matplotlib versions less than 1.5 no longer supported.')
elif int(major_version) == 2:
kwargs['color'] = coalesce(kwargs.get('c'), kwargs.get('color'),
kwargs["ax"]._get_lines.get_next_color())
kwargs['c'] = coalesce(kwargs.get('c'), kwargs.get('color'),
kwargs["ax"]._get_lines.get_next_color())
else:
kwargs['color'] = coalesce(kwargs.get('c'), kwargs.get('color'),
next(kwargs["ax"]._get_lines.prop_cycler)['color'])
kwargs['c'] = coalesce(kwargs.get('c'), kwargs.get('color'),
next(kwargs["ax"]._get_lines.prop_cycler)['color'])


def set_kwargs_drawstyle(kwargs):
Expand Down Expand Up @@ -267,7 +267,7 @@ def _plot_loglogs(loc=None, iloc=None, show_censors=False, censor_styles=None, *

# plot censors
ax = kwargs['ax']
colour = kwargs['color']
colour = kwargs['c']

if show_censors and cls.event_table['censored'].sum() > 0:
cs = {
Expand Down Expand Up @@ -353,7 +353,7 @@ def plot(loc=None, iloc=None, show_censors=False,

# plot censors
ax = kwargs['ax']
colour = kwargs['color']
colour = kwargs['c']

if show_censors and cls.event_table['censored'].sum() > 0:
cs = {
Expand Down
8 changes: 8 additions & 0 deletions tests/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ def test_both_concordance_index_function_deal_with_ties_the_same_way():
assert fast_cindex(actual_times, predicted_times, obs) == slow_cindex(actual_times, predicted_times, obs) == 1.0


def test_concordance_index_function_exits():
N = 10 * 1000
actual_times = np.random.exponential(1, size=N)
predicted_times = np.random.exponential(1, size=N)
obs = np.ones(N)
assert fast_cindex(actual_times, predicted_times, obs)


def test_survival_table_from_events_with_non_negative_T_and_no_lagged_births():
n = 10
T = np.arange(n)
Expand Down

0 comments on commit 05242f5

Please sign in to comment.