Skip to content

Commit e44e514

Browse files
authored
Merge pull request #86 from johnarban/fix-dot-plot-ymax-equals-ymin-crash-issue
Prevent divide by zero when zoomed in on section with no data
2 parents 4cdeef4 + 2955e08 commit e44e514

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

glue_plotly/common/dotplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def dot_radius(viewer, layer_state):
1313
diam_world = min([edges[i + 1] - edges[i] for i in range(len(edges) - 1)])
1414
width, height = dimensions(viewer)
1515
diam = diam_world * width / abs(viewer_state.x_max - viewer_state.x_min)
16-
if viewer_state.y_min is not None and viewer_state.y_max is not None:
16+
if viewer_state.y_min is not None and viewer_state.y_max is not None and viewer_state.y_min != viewer_state.y_max:
1717
max_diam_world_v = 1
1818
diam_pixel_v = max_diam_world_v * height / abs(viewer_state.y_max - viewer_state.y_min)
1919
diam = min(diam_pixel_v, diam)

0 commit comments

Comments
 (0)