Improved drag'n'drop of data into scatter plots so that it no longer requires
matching identifiers along dimensions.
This commit is contained in:
@@ -65,39 +65,6 @@ class BlmScatterPlot(plots.ScatterPlot):
|
||||
self.sc = self._mappable
|
||||
self.add_pc_spin_buttons(self._T.shape[1], absi, ordi)
|
||||
|
||||
def _update_color_from_dataset(self, data):
|
||||
"""Overriding scatter for testing of colormaps.
|
||||
"""
|
||||
is_category = False
|
||||
array = data.asarray()
|
||||
#only support for 2d-arrays:
|
||||
try:
|
||||
m, n = array.shape
|
||||
except:
|
||||
raise ValueError, "No support for more than 2 dimensions."
|
||||
# is dataset a vector or matrix?
|
||||
if not n==1:
|
||||
# we have a category dataset
|
||||
if isinstance(data, fluents.dataset.CategoryDataset):
|
||||
is_category = True
|
||||
map_vec = scipy.dot(array, scipy.diag(scipy.arange(n))).sum(1)
|
||||
else:
|
||||
map_vec = array.sum(1)
|
||||
else:
|
||||
map_vec = array.ravel()
|
||||
|
||||
# update facecolors
|
||||
self.sc.set_array(map_vec)
|
||||
self.sc.set_clim(map_vec.min(), map_vec.max())
|
||||
if is_category:
|
||||
cmap = cm.Paired
|
||||
else:
|
||||
cmap = cm.jet
|
||||
|
||||
self.sc.set_cmap(cmap)
|
||||
self.sc.update_scalarmappable() #sets facecolors from array
|
||||
self.canvas.draw()
|
||||
|
||||
def set_facecolor(self, colors):
|
||||
"""Set patch facecolors.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user