scatter plot selected markers are now on top (visible)
This commit is contained in:
parent
2f60d0663d
commit
a6fbef9cfa
|
@ -493,11 +493,13 @@ class Plot (View):
|
|||
|
||||
def rectangle_select_callback(self, *args):
|
||||
"""Overrriden in subclass."""
|
||||
pass
|
||||
if hasattr(self, 'canvas'):
|
||||
self.canvas.draw()
|
||||
|
||||
def lasso_select_callback(self, *args):
|
||||
"""Overrriden in subclass."""
|
||||
pass
|
||||
if hasattr(self, 'canvas'):
|
||||
self.canvas.draw()
|
||||
|
||||
def get_index_from_selection(self, dataset, selection):
|
||||
"""Returns the index vector of current selection in given dim."""
|
||||
|
@ -759,6 +761,12 @@ class ScatterPlot(Plot):
|
|||
s=self.s, c=self.c, linewidth=lw, zorder=3)
|
||||
self.axes.axhline(0, color='k', lw=1., zorder=1)
|
||||
self.axes.axvline(0, color='k', lw=1., zorder=1)
|
||||
self.selection_collection = self.axes.scatter(self.xaxis_data,
|
||||
self.yaxis_data,
|
||||
alpha=0,
|
||||
c='w',s=self.s,
|
||||
linewidth=0,
|
||||
zorder=4)
|
||||
self._background = self.canvas.copy_from_bbox(self.axes.bbox)
|
||||
|
||||
def is_mappable_with(self, obj):
|
||||
|
@ -801,7 +809,7 @@ class ScatterPlot(Plot):
|
|||
self.sc.set_clim(map_vec.min(), map_vec.max())
|
||||
self.sc.update_scalarmappable() #sets facecolors from array
|
||||
self.canvas.draw()
|
||||
|
||||
|
||||
def rectangle_select_callback(self, x1, y1, x2, y2, key):
|
||||
ydata = self.yaxis_data
|
||||
xdata = self.xaxis_data
|
||||
|
@ -830,7 +838,7 @@ class ScatterPlot(Plot):
|
|||
linewidth = scipy.zeros(self.xaxis_data.shape, 'f')
|
||||
index = self.get_index_from_selection(self.dataset_1, selection)
|
||||
if len(index) > 0:
|
||||
linewidth.put(2, index)
|
||||
linewidth.put(1, index)
|
||||
self.selection_collection.set_linewidth(linewidth)
|
||||
|
||||
if self.use_blit and len(index)>0 :
|
||||
|
|
Reference in New Issue