Changeset 4033:f5c644d9cd91 in orange


Ignore:
Timestamp:
08/01/07 22:10:27 (7 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
b8d2d555c0a73c532e3fc78aa42a6e1201892e2a
Message:

fixed node colors

Location:
orange/OrangeWidgets/Prototypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Prototypes/OWGraphDrawerCanvas.py

    r4030 r4033  
    495495            y1 = self.visualizer.coors[v][1] 
    496496             
    497             if self.colorIndex != -1: 
     497            if self.colorIndex > -1: 
    498498                if self.visualizer.graph.items.domain[self.colorIndex].varType == orange.VarTypes.Continuous: 
    499499                    newColor = self.contPalette[self.noJitteringScaledData[self.colorIndex][v]] 
    500500                elif self.visualizer.graph.items.domain[self.colorIndex].varType == orange.VarTypes.Discrete: 
    501501                    newColor = self.discPalette[self.colorIndices[self.visualizer.graph.items[v][self.colorIndex].value]] 
     502                    fillColor = newColor 
     503                    edgeColor = newColor 
    502504            else:  
    503505                newColor = Qt.red #QColor(0,0,0) 
  • orange/OrangeWidgets/Prototypes/OWNetwork.py

    r4030 r4033  
    154154        self.tooltipListBox = OWGUI.listBox(self.tooltipBox, self, "tooltipAttributes", "attributes", selectionMode=QListBox.Multi, callback=self.clickedTooltipLstBox) 
    155155 
     156        OWGUI.button(self.mainTab, self, "Show degree distribution", callback=self.showDegreeDistribution) 
    156157         
    157158        ib = OWGUI.widgetBox(self.markTab, "Info", addSpace = True) 
     
    244245            self.graph.markWithRed = self.graph.nVertices > 200 
    245246            self.graph.setMarkedNodes([i for i, values in enumerate(vgraph.items) if txt in " ".join([str(values[ndx]) for ndx in labelText])]) 
     247            print [i for i, values in enumerate(vgraph.items) if txt in " ".join([str(values[ndx]) for ndx in labelText])] 
    246248            return 
    247249         
     
    421423        if refreshRate <   1: refreshRate = 1; 
    422424        if refreshRate > 1500: refreshRate = 1500; 
    423         #print "refreshRate: " + str(refreshRate)         
     425        print "refreshRate: " + str(refreshRate)         
    424426        tolerance = 5 
    425427        initTemp = 1000 
     
    437439        if refreshRate <   1: refreshRate = 1; 
    438440        if refreshRate > 1500: refreshRate = 1500; 
    439         #print "refreshRate: " + str(refreshRate) 
     441        print "refreshRate: " + str(refreshRate) 
    440442         
    441443        tolerance = 5 
     
    447449        #print "center ndx: " + str(centerNdx) 
    448450        initTemp = self.visualize.radialFruchtermanReingold(centerNdx, refreshRate, initTemp) 
    449         self.graph.circles = [10000 / 12, 10000/12*2, 10000/12*3, 10000/12*4, 10000/12*5] 
     451        self.graph.circles = [10000 / 12, 10000/12*2, 10000/12*3]#, 10000/12*4, 10000/12*5] 
    450452        #self.graph.circles = [100, 200, 300] 
    451453        self.updateCanvas() 
     
    513515        self.graph.removeSelection(None, False) 
    514516        self.graph.addSelection(self.graph.markedNodes) 
     517         
     518    def showDegreeDistribution(self): 
     519        from matplotlib import rcParams 
     520        rcParams['text.fontname'] = 'cmr10' 
     521        import pylab as p 
     522         
     523        x = self.visualize.graph.getDegrees() 
     524        #print len(x) 
     525        #print x 
     526        # the histogram of the data 
     527        n, bins, patches = p.hist(x, 500) 
     528         
     529        p.xlabel('No. of nodes') 
     530        p.ylabel('Degree') 
     531        p.title(r'Degree distribution') 
     532         
     533        p.show() 
     534 
    515535 
    516536if __name__=="__main__":     
Note: See TracChangeset for help on using the changeset viewer.