Skip to content

Commit dc6e7bb

Browse files
committed
Adding some rounding and error messaging
1 parent 743b524 commit dc6e7bb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: packages/python/plotly/plotly/_subplots.py

+20
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,26 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):
702702
else:
703703
y_s = grid[r_spanned][c][1] + spec["b"]
704704
y_e = grid[r][c][1] + heights[-1 - r] - spec["t"]
705+
706+
if y_s > 1.0:
707+
# round for values very close to one
708+
# handles some floating point errors
709+
if y_s < 1.01:
710+
y_s = 1.0
711+
else:
712+
raise Exception(
713+
"A combination of the 'b' values, heights, and "
714+
"number of subplots too large for this subplot gird."
715+
)
716+
if y_e > 1.0:
717+
if y_e < 1.01:
718+
y_e = 1.0
719+
else:
720+
raise Exception(
721+
"A combination of the 't' values, heights, and "
722+
"number of subplots too large for this subplot gird."
723+
)
724+
705725
y_domain = [y_s, y_e]
706726

707727
list_of_domains.append(x_domain)

0 commit comments

Comments
 (0)