diff --git a/system/plots.py b/system/plots.py index 61bb72f..3c4d6c0 100644 --- a/system/plots.py +++ b/system/plots.py @@ -460,7 +460,6 @@ class ScatterPlot(Plot): return self._toolbar def rectangle_select_callback(self, x1, y1, x2, y2): - 'event1 and event2 are the press and release events' ydata = self.yaxis_data xdata = self.xaxis_data @@ -479,20 +478,13 @@ class ScatterPlot(Plot): #logger.log('debug','Selection y_start bigger than y_end') index =scipy.nonzero((xdata>x1) & (xdatay2)) - # generate ids for selected indices - reverse = {} - for key, value in self.dataset[self.current_dim].items(): - reverse[value] = key - ids = [] - for ind in index: - ids.append(reverse[ind]) - - self.selection_listener(self.current_dim,ids) + ids = self.dataset.get_identifiers(self.current_dim, index) + self.selection_listener(self.current_dim, ids) def selection_changed(self, selection): ids = selection[self.current_dim] # current identifiers - index = [ind for id,ind in self.dataset[self.current_dim].items() if id in ids] #conversion to index + index = self.dataset.get_indices(self.current_dim, ids) xdata_new = scipy.take(self.xaxis_data,index) #take data ydata_new = scipy.take(self.yaxis_data,index) self.ax.clear()