Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Made scatter use the new methods for index/identifier-conversion.

This commit is contained in:
Truls Alexander Tangstad 2006-05-03 11:40:12 +00:00
parent 5b2223afcd
commit a613f0a3fa
1 changed files with 3 additions and 11 deletions

View File

@ -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) & (xdata<x2) & (ydata<y1) & (ydata>y2))
# 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])
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()