Skip to content

Commit

Permalink
fix: two-dataset plot error when fit is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock committed Aug 27, 2024
1 parent 21e3bca commit 73c3261
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions thunor/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,12 @@ def plot_two_dataset_param_scatter(df_params, fit_param, title, subtitle,
data = []
layout = go.Layout(title=title)

slope, intercept, r_value, p_value, std_err = \
scipy.stats.linregress(xdat_fit, ydat_fit)
try:
slope, intercept, r_value, p_value, std_err = \
scipy.stats.linregress(xdat_fit, ydat_fit)
except ValueError:
slope = np.nan

if not np.isnan(slope):
xfit = (min(xdat_fit), max(xdat_fit))
yfit = [x * slope + intercept for x in xfit]
Expand Down

0 comments on commit 73c3261

Please sign in to comment.