From a6fbef9cfaf68cdd244615bc503526eea5361c3d Mon Sep 17 00:00:00 2001 From: flatberg Date: Mon, 26 Feb 2007 11:20:02 +0000 Subject: [PATCH] scatter plot selected markers are now on top (visible) --- fluents/plots.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fluents/plots.py b/fluents/plots.py index 7fdb4a8..e3ff8b7 100644 --- a/fluents/plots.py +++ b/fluents/plots.py @@ -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 :