Skip to content

Commit ab0e0ab

Browse files
positive values only for logs
1 parent 860a321 commit ab0e0ab

File tree

1 file changed

+4
-4
lines changed
  • packages/python/plotly/plotly/express/trendline_functions

1 file changed

+4
-4
lines changed

Diff for: packages/python/plotly/plotly/express/trendline_functions/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ def ols(trendline_options, x_raw, x, y, x_label, y_label, non_missing):
4545
log_y = trendline_options.get("log_y", False)
4646

4747
if log_y:
48-
if np.any(y == 0):
48+
if np.any(y <= 0):
4949
raise ValueError(
50-
"Can't do OLS trendline with `log_y=True` when `y` contains zeros."
50+
"Can't do OLS trendline with `log_y=True` when `y` contains non-positive values."
5151
)
5252
y = np.log10(y)
5353
y_label = "log10(%s)" % y_label
5454
if log_x:
55-
if np.any(x == 0):
55+
if np.any(x <= 0):
5656
raise ValueError(
57-
"Can't do OLS trendline with `log_x=True` when `x` contains zeros."
57+
"Can't do OLS trendline with `log_x=True` when `x` contains non-positive values."
5858
)
5959
x = np.log10(x)
6060
x_label = "log10(%s)" % x_label

0 commit comments

Comments
 (0)