Changeset 55:cda1d0456628 in orange


Ignore:
Timestamp:
04/08/03 11:39:00 (10 years ago)
Author:
Gregor <Gregor@…>
Branch:
default
Convert:
adeb50af347d314ba3b155ae7db4fdaf85f84f6a
Message:

dela tudi ko za razred izberes poljubni diskretni atribut

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWParallelGraph.py

    r54 r55  
    169169                if data[i][index].isSpecial(): temp.append(1) 
    170170                else: 
    171                     val = (1.0 + 2.0*float(variableValueIndices[data[i][index].value])) / float(2*count) + 0.3 * self.rndCorrection(1.0/count) 
     171                    val = (1.0 + 2.0*float(variableValueIndices[data[i][index].value])) / float(2*count) + 0.2 * self.rndCorrection(1.0/count) 
    172172                    temp.append(val) 
    173173                     
     
    221221        self.setAxisMaxMinor(QwtPlot.xBottom, 0) 
    222222        self.setAxisMaxMajor(QwtPlot.xBottom, len(labels)) 
     223        self.setAxisMaxMinor(QwtPlot.yLeft, 0) 
     224        self.setAxisMaxMajor(QwtPlot.yLeft, 1) 
     225         
    223226 
    224227        if len(self.scaledData) == 0 or len(labels) == 0: self.updateLayout(); return 
     
    268271 
    269272    def showDistributionValues(self, className, data, indices): 
    270         # create color table 
     273        # get index of class          
     274        classNameIndex = 0 
     275        for i in range(len(data.domain)): 
     276            if data.domain[i].name == className: classNameIndex = i 
     277 
     278        # create color table             
    271279        count = float(len(data.domain[className].values)) 
    272280        if count < 1: 
     
    302310                        # processing for distributions 
    303311                        attrIndex = variableValueIndices[data[i][index].value] 
    304                         classIndex = classValueIndices[data[i].getclass().value] 
     312                        classIndex = classValueIndices[data[i][classNameIndex].value] 
    305313                        totals[attrIndex] += 1 
    306314                        values[classIndex][attrIndex] = values[classIndex][attrIndex] + 1 
    307315 
    308                  
     316                maximum = 0 
     317                for i in range(len(values)): 
     318                    for j in range(len(values[i])): 
     319                        if values[i][j] > maximum: maximum = values[i][j] 
     320                         
    309321                # create bar curve 
    310322                for i in range(count): 
     
    316328                    yData = [] 
    317329                    for j in range(attrLen): 
    318                         width = float(values[i][j]*0.5) / float(totals[j]) 
     330                        #width = float(values[i][j]*0.5) / float(totals[j]) 
     331                        width = float(values[i][j]*0.5) / float(maximum) 
    319332                        interval = 1.0/float(2*attrLen) 
    320                         #yOff = (j / float(attrLen-1)) * (1.0-2.0*interval) 
    321333                        yOff = float(1.0 + 2.0*j)/float(2*attrLen) 
    322334                        height = 0.7/float(count*attrLen) 
Note: See TracChangeset for help on using the changeset viewer.