From 2955e08bf7f40e813a93b297c77c98c36942cd92 Mon Sep 17 00:00:00 2001 From: John Arban Lewis Date: Tue, 20 Aug 2024 11:07:54 -0400 Subject: [PATCH] prevent divide by zero when zoomed in on section with no data --- glue_plotly/common/dotplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glue_plotly/common/dotplot.py b/glue_plotly/common/dotplot.py index 9b94e28..6229526 100644 --- a/glue_plotly/common/dotplot.py +++ b/glue_plotly/common/dotplot.py @@ -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)