Skip to content

Commit

Permalink
prevent divide by zero when zoomed in on section with no data
Browse files Browse the repository at this point in the history
  • Loading branch information
johnarban committed Aug 20, 2024
1 parent 4cdeef4 commit 2955e08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion glue_plotly/common/dotplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def dot_radius(viewer, layer_state):
diam_world = min([edges[i + 1] - edges[i] for i in range(len(edges) - 1)])
width, height = dimensions(viewer)
diam = diam_world * width / abs(viewer_state.x_max - viewer_state.x_min)
if viewer_state.y_min is not None and viewer_state.y_max is not None:
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:
max_diam_world_v = 1
diam_pixel_v = max_diam_world_v * height / abs(viewer_state.y_max - viewer_state.y_min)
diam = min(diam_pixel_v, diam)
Expand Down

0 comments on commit 2955e08

Please sign in to comment.