From a613f0a3fad90d877772a59ee8e70460df33ee61 Mon Sep 17 00:00:00 2001 From: tangstad Date: Wed, 3 May 2006 11:40:12 +0000 Subject: [PATCH] Made scatter use the new methods for index/identifier-conversion. --- system/plots.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) 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()