Skip to content

Commit

Permalink
fixed test. had to return figure and axis, so the test can save the i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
aGuyLearning committed Dec 13, 2024
1 parent b3a7c21 commit cfdb1cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ehrapy/plot/_survival_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def cox_ph_forestplot(
decimal: int = 2,
text_size: int = 12,
color: str = "k",
show: bool = True,
show: bool = None,
title: str | None = None,
):
"""Generates a forest plot to visualize the coefficients and confidence intervals of a Cox Proportional Hazards model.
Expand All @@ -332,7 +332,7 @@ def cox_ph_forestplot(
decimal: Number of decimal places to display.
text_size: Font size of the text.
color: Color of the markers.
show: Show the plot, do not return axis.
show: Show the plot, do not return figure and axis.
title: Set the title of the plot.
Examples:
Expand Down Expand Up @@ -393,7 +393,7 @@ def cox_ph_forestplot(

x_axis_lower_bound = round(((pd.to_numeric(coxph_summary["coef lower 95%"])).min() - 0.1), 1)

plt.figure(figsize=fig_size)
fig = plt.figure(figsize=fig_size)
gspec = gridspec.GridSpec(1, 6)
plot = plt.subplot(gspec[0, 0:4]) # plot of data
tabl = plt.subplot(gspec[0, 4:]) # table
Expand Down Expand Up @@ -443,7 +443,7 @@ def cox_ph_forestplot(
plt.title(title)

if not show:
return plot
return fig, plot

else:
return None

0 comments on commit cfdb1cc

Please sign in to comment.