Changeset 3539:b701cf95c912 in orange


Ignore:
Timestamp:
04/16/07 10:25:14 (7 years ago)
Author:
Gregor <Gregor@…>
Branch:
default
Convert:
67f333c1f0fdc31aa56fd46bbe704a0c850e3395
Message:
  • small bug fixes
Location:
orange/OrangeWidgets
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWGraphTools.py

    r3501 r3539  
    253253            return (0, xi, yi) 
    254254 
    255  
     255# a class that draws unconnected lines. first two points in the xData and yData are considered as the first line, 
     256# the second two points as the second line, etc. 
    256257class UnconnectedLinesCurve(QwtPlotCurve): 
    257258    def __init__(self, parent, pen = QPen(Qt.black), xData = None, yData = None): 
     
    278279    def __init__(self, parent, pen = QPen(Qt.black), brush = QBrush(Qt.white), xData = None, yData = None): 
    279280        QwtPlotCurve.__init__(self, parent) 
    280         self.setPen(pen) 
    281         self.setBrush(brush) 
     281        if pen: 
     282            self.setPen(pen) 
     283        if brush: 
     284            self.setBrush(brush) 
    282285        self.Pen = pen 
    283286        self.Brush = brush 
     
    286289            self.setData(xData, yData) 
    287290 
    288     def drawCurve(self, painter, style, xMap, yMap, start, stop): 
    289         for i in range(start, stop, 4): 
    290             QwtPlotCurve.drawLines(self, painter, xMap, yMap, i, i+3) 
     291#    def drawCurve(self, painter, style, xMap, yMap, start, stop): 
     292#        for i in range(start, stop, 4): 
     293#            QwtPlotCurve.drawLines(self, painter, xMap, yMap, i, i+4) 
    291294 
    292295# #################################################################### 
  • orange/OrangeWidgets/OWkNNOptimization.py

    r3489 r3539  
    10911091                    s += "<hr>Gene sets for individual genes:<br>&nbsp; &nbsp; <b>%s</b>: %s<br>&nbsp; &nbsp; <b>%s</b>: %s" % (attributes[x], getGeneSet(self.geneToSet, attributes[x]), attributes[yy], getGeneSet(self.geneToSet, attributes[yy])) 
    10921092 
    1093                 curve = PolygonCurve(self.graph, QPen(color, 1), QBrush(color), [x-0.5+eps, x+0.5-eps, x+0.5-eps, x-0.5+eps], [y+1-0.5+eps, y+1-0.5+eps, y+1+0.5-eps, y+1+0.5-eps]) 
    1094                 key = self.graph.insertCurve(curve) 
     1093                key = self.graph.insertCurve(PolygonCurve(self.graph, QPen(color, 1), QBrush(color), [x-0.5+eps, x+0.5-eps, x+0.5-eps, x-0.5+eps, x-0.5+eps], [y+1-0.5+eps, y+1-0.5+eps, y+1+0.5-eps, y+1+0.5-eps, y+1-0.5+eps])) 
    10951094 
    10961095                if self.useGeneSets and self.geneToSet and sharedGeneSets != []: 
    1097                     curve = PolygonCurve(self.graph, QPen(color, 1), QBrush(Qt.NoBrush), [x-0.5+eps2, x+0.5-eps2, x+0.5-eps2, x-0.5+eps2], [y+1-0.5+eps2, y+1-0.5+eps2, y+1+0.5-eps2, y+1+0.5-eps2]) 
    1098                     key = self.graph.insertCurve(curve) 
     1096                    key = self.graph.insertCurve(PolygonCurve(self.graph, QPen(color, 1), QBrush(Qt.NoBrush), [x-0.5+eps2, x+0.5-eps2, x+0.5-eps2, x-0.5+eps2, x-0.5+eps2], [y+1-0.5+eps2, y+1-0.5+eps2, y+1+0.5-eps2, y+1+0.5-eps2, y+1-0.5+eps2])) 
    10991097                if s != "": 
    11001098                    self.graph.tips.addToolTip(x, y+1, s, 0.5, 0.5) 
    11011099 
    11021100                if not self.onlyLower: 
    1103                     curve = PolygonCurve(self.graph, QPen(color, 1), QBrush(color), [num-1-0.5-y+eps, num-1-0.5-y+eps, num-1+0.5-y-eps, num-1+0.5-y-eps], [num-0.5-x+eps, num+0.5-x-eps, num+0.5-x-eps, num-0.5-x+eps]) 
    1104                     key = self.graph.insertCurve(curve) 
     1101                    key = self.graph.insertCurve(PolygonCurve(self.graph, QPen(color, 1), QBrush(color), [num-1-0.5-y+eps, num-1-0.5-y+eps, num-1+0.5-y-eps, num-1+0.5-y-eps, num-1-0.5-y+eps], [num-0.5-x+eps, num+0.5-x-eps, num+0.5-x-eps, num-0.5-x+eps, num-0.5-x+eps])) 
    11051102 
    11061103                    if self.useGeneSets and self.geneToSet and sharedGeneSets != []: 
    1107                         curve = PolygonCurve(self.graph, QPen(color, 1), QBrush(Qt.NoBrush), [num-1-0.5-y+eps2, num-1-0.5-y+eps2, num-1+0.5-y-eps2, num-1+0.5-y-eps2], [num-0.5-x+eps2, num+0.5-x-eps2, num+0.5-x-eps2, num-0.5-x+eps2]) 
    1108                         key = self.graph.insertCurve(curve) 
     1104                        key = self.graph.insertCurve(PolygonCurve(self.graph, QPen(color, 1), QBrush(Qt.NoBrush), [num-1-0.5-y+eps2, num-1-0.5-y+eps2, num-1+0.5-y-eps2, num-1+0.5-y-eps2, num-1-0.5-y+eps2], [num-0.5-x+eps2, num+0.5-x-eps2, num+0.5-x-eps2, num-0.5-x+eps2, num-0.5-x+eps2])) 
    11091105                    if s != "": 
    11101106                        self.graph.tips.addToolTip(num-1-y, num-x, s, 0.5, 0.5) 
     
    11121108        # draw empty boxes at the diagonal 
    11131109        for x in range(num): 
    1114             curve = PolygonCurve(self.graph, QPen(black, 1), QBrush(white), [x-0.5+2*eps2, x+0.5-2*eps2, x+0.5-2*eps2, x-0.5+2*eps2], [num-x-0.5+2*eps2, num-x-0.5+2*eps2, num-x+0.5-2*eps2, num-x+0.5-2*eps2]) 
    1115             key = self.graph.insertCurve(curve) 
     1110            key = self.graph.insertCurve(PolygonCurve(self.graph, QPen(black), QBrush(Qt.NoBrush), [x-0.5+2*eps2, x+0.5-2*eps2, x+0.5-2*eps2, x-0.5+2*eps2, x-0.5+2*eps2], [num-x-0.5+2*eps2, num-x-0.5+2*eps2, num-x+0.5-2*eps2, num-x+0.5-2*eps2, num-x-0.5+2*eps2])) 
    11161111 
    11171112        """ 
     
    13361331                color = black 
    13371332 
    1338             curve = PolygonCurve(self.graph, QPen(color, 1), QBrush(color)) 
     1333            curve = PolygonCurve(self.graph, QPen(color, 1), QBrush(color), [ind-0.5+eps, ind+0.5-eps, ind+0.5-eps, ind-0.5+eps, ind-0.5+eps], [0, 0, count, count, 0]) 
    13391334            key = self.graph.insertCurve(curve) 
    1340             self.graph.setCurveData(key, [ind-0.5+eps, ind+0.5-eps, ind+0.5-eps, ind-0.5+eps], [0, 0, count, count]) 
    13411335 
    13421336            if self.progressLines and count*8 > maxProjCount: 
     
    16781672 
    16791673            index += 1 
    1680             self.statusBar.message("Evaluated %s/%s projections..." % (orngVisFuncts.createStringFromNumber(existing + index), orngVisFuncts.createStringFromNumber(projCount))) 
     1674            self.setStatusBarText("Evaluated %s/%s projections..." % (orngVisFuncts.createStringFromNumber(existing + index), orngVisFuncts.createStringFromNumber(projCount))) 
    16811675            self.widget.progressBarSet(100.0*(index)/float(projCount-existing)) 
    16821676 
     
    17041698 
    17051699            self.widgetStatusArea.show() 
    1706             self.statusBar.message("Computing averages...") 
     1700            self.setStatusBarText("Computing averages...") 
    17071701 
    17081702            projCount = min(int(self.projectionCount), len(self.results)) 
     
    17201714 
    17211715            self.widget.outlierValues = (values, "Probability of correct class value = %.2f%%") 
    1722             self.statusBar.message("") 
    1723             self.widgetStatusArea.hide() 
     1716            self.setStatusBarText("") 
     1717            #self.widgetStatusArea.hide() 
    17241718        else: 
    17251719            self.widget.outlierValues = None 
     
    18261820                    continue 
    18271821                xDiff = self.graphMatrix[j][index] 
    1828                 self.graph.insertCurve(OWGraphTools.PolygonCurve(self.graph, QPen(classColors.getColor(j)), QBrush(classColors.getColor(j)), [x, x+xDiff, x+xDiff, x], [i, i, i+1, i+1])) 
     1822                self.graph.insertCurve(PolygonCurve(self.graph, QPen(classColors.getColor(j)), QBrush(classColors.getColor(j)), [x, x+xDiff, x+xDiff, x, x], [i, i, i+1, i+1, i])) 
    18291823                x += xDiff 
    18301824            self.graph.tips.addToolTip(0, i, s[:-4], 1, 1) 
     
    18481842        y = int(math.floor(self.graph.invTransform(QwtPlot.yLeft, e.y()))) 
    18491843        if self.showClickedProjection and y >= 0 and y < len(self.projectionIndices): 
    1850             diff  = 0.01 
    1851             self.selectedRectangle = self.graph.insertCurve(OWGraphTools.PolygonCurve(self.graph, brush = QBrush(Qt.NoBrush), xData = [0-diff, 1+diff, 1+diff, 0-diff], yData = [y-diff, y-diff, y+1+diff, y+1+diff])) 
     1844            diff  = 0.005 
     1845            self.selectedRectangle = self.graph.insertCurve(PolygonCurve(self.graph, brush = QBrush(Qt.NoBrush), xData = [0-diff, 1+diff, 1+diff, 0-diff, 0-diff], yData = [y-diff, y-diff, y+1+diff, y+1+diff, y-diff])) 
    18521846            self.graph.replot() 
    18531847 
  • orange/OrangeWidgets/Visualize/OWLinProjGraph.py

    r3503 r3539  
    7878        OWGraph.setData(self, data) 
    7979        orngScaleLinProjData.setData(self, data) 
    80         self.anchorData = [] 
     80        #self.anchorData = [] 
    8181 
    8282        self.setAxisScale(QwtPlot.yLeft, -1.13, 1.13, 1) 
     
    9898        self.dataMap = {}   # dictionary with keys of form "x_i-y_i" with values (x_i, y_i, color, data) 
    9999 
    100         if self.scaledData == None or len(labels) < 3: self.updateLayout(); return 
     100        if self.scaledData == None or len(labels) < 3: 
     101            self.anchorData = [] 
     102            self.updateLayout() 
     103            return 
    101104 
    102105        haveSubsetData = self.subsetData and self.rawdata and self.subsetData.domain.checksum() == self.rawdata.domain.checksum() 
     
    105108        hasContinuousClass = hasClass and self.rawdata.domain.classVar.varType == orange.VarTypes.Continuous 
    106109 
    107         indices = [self.attributeNameIndex[label] for label in labels]  # store indices to shown attributes 
    108  
    109110        if setAnchors or (args.has_key("XAnchors") and args.has_key("YAnchors")): 
    110111            self.potentialsBmp = None 
    111112            self.setAnchors(args.get("XAnchors"), args.get("YAnchors"), labels) 
    112113            #self.anchorData = self.createAnchors(len(labels), labels)    # used for showing tooltips 
     114 
     115        indices = [self.attributeNameIndex[anchor[2]] for anchor in self.anchorData]  # store indices to shown attributes 
    113116 
    114117        # do we want to show anchors and their labels 
  • orange/OrangeWidgets/Visualize/OWParallelGraph.py

    r3483 r3539  
    284284                    elif self.showStatistics == MEDIAN: 
    285285                        sorted = numpy.sort(array) 
    286                         data.append([(sorted[int(len(sorted)/4.0)], sorted[int(len(sorted)/2.0)], sorted[int(len(sorted)*0.75)])]) 
     286                        if len(sorted) > 0: 
     287                            data.append([(sorted[int(len(sorted)/4.0)], sorted[int(len(sorted)/2.0)], sorted[int(len(sorted)*0.75)])]) 
     288                        else: 
     289                            data.append([(0,0,0)]) 
    287290                else: 
    288291                    curr = [] 
Note: See TracChangeset for help on using the changeset viewer.