Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Fixed linewidth in selection in scatter plots.

This commit is contained in:
Einar Ryeng 2007-07-05 11:57:21 +00:00
parent d29013a863
commit a503ffcdf8
1 changed files with 10 additions and 2 deletions

View File

@ -349,6 +349,8 @@ class ScatterPlot(Plot):
"""The ScatterPlot is slower than scattermarker, but has size option.""" """The ScatterPlot is slower than scattermarker, but has size option."""
@plotlogger @plotlogger
def __init__(self, dataset_1, dataset_2, id_dim, sel_dim, id_1, id_2, c='b', s=30, sel_dim_2=None, name="Scatter plot", **kw): def __init__(self, dataset_1, dataset_2, id_dim, sel_dim, id_1, id_2, c='b', s=30, sel_dim_2=None, name="Scatter plot", **kw):
"""Initializes a scatter plot.
"""
Plot.__init__(self, name) Plot.__init__(self, name)
self.dataset_1 = dataset_1 self.dataset_1 = dataset_1
@ -407,6 +409,7 @@ class ScatterPlot(Plot):
self.yaxis_data, self.yaxis_data,
alpha=0, alpha=0,
c='w',s=self.s, c='w',s=self.s,
edgecolor='r',
linewidth=0, linewidth=0,
zorder=4) zorder=4)
self._background = self.canvas.copy_from_bbox(self.axes.bbox) self._background = self.canvas.copy_from_bbox(self.axes.bbox)
@ -480,7 +483,7 @@ class ScatterPlot(Plot):
linewidth = scipy.zeros(self.xaxis_data.shape, 'f') linewidth = scipy.zeros(self.xaxis_data.shape, 'f')
index = self.get_index_from_selection(self.dataset_1, selection) index = self.get_index_from_selection(self.dataset_1, selection)
if len(index) > 0: if len(index) > 0:
linewidth.put(1, index) linewidth[index] = 1.5
self.selection_collection.set_linewidth(linewidth) self.selection_collection.set_linewidth(linewidth)
if self._use_blit and len(index)>0 : if self._use_blit and len(index)>0 :
@ -527,9 +530,14 @@ class HistogramPlot(Plot):
self.current_dim = dataset.get_dim_name(1) self.current_dim = dataset.get_dim_name(1)
if dataset.shape[1]==1: if dataset.shape[1]==1:
self.current_dim = dataset.get_dim_name(0) self.current_dim = dataset.get_dim_name(0)
# Set default paramteters
if not kw.has_key('bins'):
kw['bins'] = 20
# Initial draw # Initial draw
self.axes.grid(False) self.axes.grid(False)
bins = min(self._data.size, 20) bins = min(self._data.size, kw['bins'])
count, lims, self.patches = self.axes.hist(self._data, bins=bins) count, lims, self.patches = self.axes.hist(self._data, bins=bins)
# Add identifiers to the individual patches # Add identifiers to the individual patches