Skip to content

Commit

Permalink
Update grid specification in kaplan_meier function and rerendered tes…
Browse files Browse the repository at this point in the history
…t images
  • Loading branch information
aGuyLearning committed Jan 21, 2025
1 parent ce89e61 commit db91335
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions ehrapy/plot/_survival_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def kaplan_meier(
color = [None] * len(kmfs)

fig = plt.figure(constrained_layout=True, figsize=figsize)
spec = fig.add_gridspec(2, 1)
spec = fig.add_gridspec(2, 1) if display_survival_statistics else fig.add_gridspec(1, 1)
ax = plt.subplot(spec[0, 0])

for i, kmf in enumerate(kmfs):
Expand Down Expand Up @@ -301,7 +301,6 @@ def kaplan_meier(
if title:
ax.set_title(title)

# Prepare data for the table
if display_survival_statistics:
xticks = [x for x in ax.get_xticks() if x >= 0]
xticks_space = xticks[1] - xticks[0]
Expand Down
10 changes: 5 additions & 5 deletions tests/_scripts/kaplain_meier_create_expected_plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -27,7 +27,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -86,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down
Binary file modified tests/plot/_images/kaplan_meier_expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit db91335

Please sign in to comment.