Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Optimized plot selection.

This commit is contained in:
Truls Alexander Tangstad 2006-04-25 10:08:12 +00:00
parent 359903c5ab
commit 9d7a5ba769
1 changed files with 11 additions and 2 deletions

View File

@ -260,6 +260,8 @@ class ScatterPlot(Plot):
x2, y2 = event2.xdata, event2.ydata
ydata = self.yaxis_data
xdata = self.xaxis_data
# find indices of selected area
if x1>x2:
if y1<y2:
index =scipy.nonzero((xdata<x1) & (xdata>x2) & (ydata>y1) & (ydata<y2))
@ -274,7 +276,14 @@ class ScatterPlot(Plot):
#logger.log('debug','Selection y_start bigger than y_end')
index =scipy.nonzero((xdata>x1) & (xdata<x2) & (ydata<y1) & (ydata>y2))
ids = [id for id,ind in self.dataset[self.current_dim].items() if ind in index]
# 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.project.set_selection(self.current_dim,ids)
def update(self, key):