Changeset 10915:d723c43ab30d in orange


Ignore:
Timestamp:
06/16/12 13:27:11 (22 months ago)
Author:
mstajdohar
Branch:
default
rebase_source:
62bb80cf8d0f6b4bfbc98d8c6a3c7acf19c03d91
Message:

Color models by label.

Location:
Orange/OrangeWidgets/Unsupervised
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Unsupervised/OWNxCanvasQt.py

    r10878 r10915  
    504504            colors.update((v, self.discPalette[colorIndices[self.items[v][colorIndex].value]]) for v in nodes) 
    505505 
     506        elif colorIndex is not None and self.items.domain[colorIndex].varType == core.VarTypes.String and self.items.domain[colorIndex].name == "label": 
     507            colorIndices = {v: i for i, v in enumerate(set(inst[colorIndex].value for inst in self.items))} 
     508            colors.update((v, self.discPalette[colorIndices[self.items[v][colorIndex].value]]) for v in nodes) 
    506509        else: 
    507510            colors.update((node, self.discPalette[0]) for node in nodes) 
  • Orange/OrangeWidgets/Unsupervised/OWNxExplorer.py

    r10878 r10915  
    652652                        self.vertexSizeCombo.addItem(self.icons.get(var.varType, self.icons[-1]), "num of " + unicode(var.name)) 
    653653 
    654                 elif var.varType in [feature.Type.Continuous]: 
    655                     self.vertexSizeCombo.addItem(self.icons.get(var.varType, self.icons[-1]), unicode(var.name)) 
     654                if var.varType in [feature.Type.String] and var.name == "label": 
     655                    self.colorCombo.addItem(self.icons.get(var.varType, self.icons[-1]), unicode(var.name)) 
    656656 
    657657                self.nameComponentCombo.addItem(self.icons.get(var.varType, self.icons[-1]), unicode(var.name)) 
Note: See TracChangeset for help on using the changeset viewer.