Skip to content

Commit cc15994

Browse files
committed
Catch ValueErrors that can arise while doing histogram computations.
1 parent a2b2f1b commit cc15994

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

glue_plotly/viewers/histogram/dotplot_layer_artist.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _calculate_histogram(self):
5252
try:
5353
self.state.reset_cache()
5454
self.bins, self.hist_unscaled = self.state.histogram
55-
except IncompatibleAttribute:
55+
except (IncompatibleAttribute, ValueError):
5656
self.disable('Could not compute histogram')
5757
self.bins = self.hist_unscaled = None
5858

@@ -121,11 +121,14 @@ def _update_data(self):
121121
for trace in old_dots:
122122
self.view._remove_trace_index(trace)
123123

124-
dots = traces_for_layer(self.view, self.state, add_data_label=True)
125-
for trace in dots:
126-
trace.update(hoverinfo='all', unselected=dict(marker=dict(opacity=self.state.alpha)))
127-
self._dots_id = dots[0].meta if dots else None
128-
self.view.figure.add_traces(dots)
124+
try:
125+
dots = traces_for_layer(self.view, self.state, add_data_label=True)
126+
for trace in dots:
127+
trace.update(hoverinfo='all', unselected=dict(marker=dict(opacity=self.state.alpha)))
128+
self._dots_id = dots[0].meta if dots else None
129+
self.view.figure.add_traces(dots)
130+
except (IncompatibleAttribute, ValueError):
131+
pass
129132

130133
def _update_zorder(self, *args):
131134
current_traces = self.view.figure.data

0 commit comments

Comments
 (0)