Changeset 3700:7a78385cc9c1 in orange


Ignore:
Timestamp:
05/27/07 18:58:18 (7 years ago)
Author:
Gregor <Gregor@…>
Branch:
default
Convert:
5c9ffd7e122ad2297e6a1d5ac9ce85f9cc0d0b33
Message:
  • small changes
Location:
orange/OrangeWidgets
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWDlgs.py

    r3558 r3700  
    390390    def loadCBPalette(self): 
    391391        self.discListbox.clear() 
    392         self.discreteColors = [QColor(r,g,b) for (r,g,b) in OWGraphTools.ColorBrewerRGBValues] 
     392        self.discreteColors = [QColor(r,g,b) for (r,g,b) in OWGraphTools.ColorBrewerColors] 
    393393        for ind in range(len(self.discreteColors)): 
    394394            self.discListbox.insertItem(OWTools.ColorPixmap(self.discreteColors[ind], 15), "Color %d" % (ind)) 
  • orange/OrangeWidgets/OWFreeVizOptimization.py

    r3537 r3700  
    5454        if parentName.lower() != "radviz": 
    5555            self.LinearTransformationTab = QVGroupBox(self) 
    56             self.tabs.insertTab(self.LinearTransformationTab, "Supervised PCA") 
     56            self.tabs.insertTab(self.LinearTransformationTab, "Dimensionality Reduction") 
    5757 
    5858        # ########################### 
     
    128128        # SUPERVISED PCA TAB 
    129129        if parentName.lower() != "radviz": 
    130             OWGUI.button(self.LinearTransformationTab, self, "Find PCA projection", callback = self.findPCAProjection) 
    131             OWGUI.button(self.LinearTransformationTab, self, "Find supervised PCA projection", callback = self.findSPCAProjection) 
    132             OWGUI.checkBox(self.LinearTransformationTab, self, "useGeneralizedEigenvectors", "Try to merge examples with same class value") 
    133  
     130            pcaBox = OWGUI.widgetBox(self.LinearTransformationTab, "Principal Component Analysis") 
     131            OWGUI.button(pcaBox, self, "Principal component analysis", callback = self.findPCAProjection) 
     132            OWGUI.button(pcaBox, self, "Supervised principal component analysis", callback = self.findSPCAProjection) 
     133            OWGUI.checkBox(pcaBox, self, "useGeneralizedEigenvectors", "Merge examples with same class value") 
     134            plsBox = OWGUI.widgetBox(self.LinearTransformationTab, "Partial Least Squares") 
     135            OWGUI.button(plsBox, self, "Partial least squares", callback = self.findPLSProjection) 
     136             
    134137 
    135138        # ########################### 
     
    291294 
    292295    def findPCAProjection(self): 
    293         self.findProjection(0) 
     296        self.findProjection(DR_PCA) 
    294297 
    295298    def findSPCAProjection(self): 
    296         self.findProjection(1) 
    297  
    298     def findProjection(self, SPCA): 
    299         import LinearAlgebra 
    300  
    301         ai = self.graph.attributeNameIndex 
    302         attributes = self.getShownAttributeList() 
    303         attrIndices = [ai[label] for label in attributes] 
    304         validData = self.graph.getValidList(attrIndices) 
    305         if sum(validData) <= len(attrIndices): 
    306             self.setStatusBarText("More attributes than examples. Singular matrix. Exiting...") 
    307             return 
    308  
    309         FreeViz.findSPCAProjection(self, attrIndices, setGraphAnchors = 1, SPCA = SPCA) 
    310  
    311         self.graph.updateData() 
    312         self.graph.repaint() 
    313  
     299        self.findProjection(DR_SPCA) 
     300 
     301    def findPLSProjection(self): 
     302        self.findProjection(DR_PLS) 
    314303 
    315304    def setStatusBarText(self, text): 
  • orange/OrangeWidgets/OWGraph.py

    r3561 r3700  
    668668        f.write("from pylab import *\nfrom matplotlib import font_manager\n\n#possible changes in how the plot looks\n#rcParams['xtick.major.size'] = 0\n#rcParams['ytick.major.size'] = 0\n\n#constants\nx1 = %f; x2 = %f\ny1 = %f; y2 = %f\ndpi = 80\nxsize = %d\nysize = %d\nedgeOffset = %f\n\nfigure(facecolor = 'w', figsize = (xsize/float(dpi), ysize/float(dpi)), dpi = dpi)\nhold(True)\n" % (x1,x2,y1,y2,size.width(), size.height(), edgeOffset)) 
    669669 
    670         linestyles = ["o", "-", "-.", "--", ":", "-", "-"]      # qwt line styles: NoCurve, Lines, Sticks, Steps, Dots, Spline, UserCurve 
     670        linestyles = ['None', "-", "-.", "--", ":", "-", "-"]      # qwt line styles: NoCurve, Lines, Sticks, Steps, Dots, Spline, UserCurve 
    671671        markers = ["None", "o", "s", "^", "d", "v", "^", "<", ">", "x", "+"]    # curveSymbols = [None, Ellipse, Rect, Triangle, Diamond, DTriangle, UTriangle, LTriangle, RTriangle, XCross, Cross] 
    672672 
  • orange/OrangeWidgets/OWGraphTools.py

    r3554 r3700  
    1818#colorHueValues = [240, 0, 120, 30, 60, 300, 180, 150, 270, 90, 210, 330, 15, 135, 255, 45, 165, 285, 105, 225, 345] 
    1919 
    20 #ColorBrewer color set - bad when there are small points 
    21 ColorBrewerRGBValues = [(0, 140, 255), (228, 26, 28), (77, 175, 74), (255, 127, 0), (255, 255, 51), (152, 78, 163), (166, 86, 40), (247, 129, 191), (153, 153, 153)] 
     20#ColorBrewer color set - bad when there are small points but great when you have to color areas 
     21ColorBrewerColors = [(0, 140, 255), (228, 26, 28), (77, 175, 74), (255, 127, 0), (255, 255, 51), (152, 78, 163), (166, 86, 40), (247, 129, 191), (153, 153, 153)] 
    2222 
    2323class ColorPaletteGenerator: 
  • orange/OrangeWidgets/OWkNNOptimization.py

    r3567 r3700  
    1212                    "argumentCount", "optimizeBestProjection", "optimizeBestProjectionTime", 
    1313                    "locOptMaxAttrsInProj", "locOptAttrsToTry", "locOptProjCount", "locOptAllowAddingAttributes", 
    14                     "useExampleWeighting", "useSupervisedPCA", "attrSubsetSelection", "optimizationType", "attributeCount", 
     14                    "useExampleWeighting", "projOptimizationMethod", "attrSubsetSelection", "optimizationType", "attributeCount", 
    1515                    "locOptOptimizeProjectionByPermutingAttributes", "timeLimit", "projectionLimit", "storeEachPermutation", 
    1616                    "boxLocalOptimization", "boxStopOptimization"] 
     
    126126 
    127127        if visualizationMethod == LINEAR_PROJECTION: 
    128             OWGUI.checkBox(self.SettingsTab, self, 'useSupervisedPCA', 'Optimize class separation using supervised PCA', box = " Supervised PCA ") 
    129         else: self.useSupervisedPCA = 0 
     128            OWGUI.comboBox(self.SettingsTab, self, "projOptimizationMethod", "Projection Optimization Method", items = ["None", "Supervised projection pursuit", "Partial least square"], sendSelectedValue = 0, tooltip = "What method do you want to use to find an interesting projection with good class separation?") 
     129        else: 
     130            self.projOptimizationMethod = 0 
    130131 
    131132        self.measureCombo = OWGUI.comboBox(self.SettingsTab, self, "qualityMeasure", box = " Measure of Classification Success ", items = ["Classification accuracy", "Average probability assigned to the correct class", "Brier score", "Area under curve (AUC)"], tooltip = "Measure to evaluate prediction accuracy of k-NN method on the projected data set.") 
     
    774775    def evaluateProjections(self): 
    775776        if str(self.startOptimizationButton.text()) == "Start Evaluating Projections": 
    776             if self.attributeCount >= 10 and not (self.useSupervisedPCA) and self.visualizationMethod != SCATTERPLOT and self.attrSubsetSelection != GAMMA_SINGLE and QMessageBox.critical(self, 'VizRank', 'You chose to evaluate projections with a high number of attributes. Since VizRank has to evaluate different placements\nof these attributes there will be a high number of projections to evaluate. Do you still want to proceed?','Continue','Cancel', '', 0,1): 
    777                 return 
    778             if not self.data.domain.classVar or not self.data.domain.classVar.varType == orange.VarTypes.Discrete: 
    779                 QMessageBox.information( None, self.parentName, "Projections can be evaluated only for data with a discrete class.", QMessageBox.Ok + QMessageBox.Default) 
    780                 return 
    781             self.startOptimizationButton.setText("Stop Evaluation") 
    782  
    783             self.parentWidget.progressBarInit() 
     777            try: 
     778                if self.attributeCount >= 10 and self.projOptimizationMethod == 0 and self.visualizationMethod != SCATTERPLOT and self.attrSubsetSelection != GAMMA_SINGLE and QMessageBox.critical(self, 'VizRank', 'You chose to evaluate projections with a high number of attributes. Since VizRank has to evaluate different placements\nof these attributes there will be a high number of projections to evaluate. Do you still want to proceed?','Continue','Cancel', '', 0,1): 
     779                    return 
     780                if not self.data.domain.classVar or not self.data.domain.classVar.varType == orange.VarTypes.Discrete: 
     781                    QMessageBox.information( None, self.parentName, "Projections can be evaluated only for data with a discrete class.", QMessageBox.Ok + QMessageBox.Default) 
     782                    return 
     783                self.startOptimizationButton.setText("Stop Evaluation") 
     784 
     785                self.parentWidget.progressBarInit() 
     786                self.disableControls() 
     787                evaluatedProjections = VizRank.evaluateProjections(self) 
     788                self.enableControls() 
     789                self.parentWidget.progressBarFinished() 
     790 
     791                secs = time.time() - self.startTime 
     792                self.setStatusBarText("Finished evaluation (evaluated %s projections in %d min, %d sec)" % (orngVisFuncts.createStringFromNumber(evaluatedProjections), secs/60, secs%60)) 
     793                self.finishedAddingResults() 
     794                qApp.processEvents() 
     795                if self.parentWidget: 
     796                    self.parentWidget.showSelectedAttributes() 
     797            except: 
     798                type, val, traceback = sys.exc_info() 
     799                sys.excepthook(type, val, traceback)  # print the exception 
     800            self.startOptimizationButton.setText("Start Evaluating Projections") 
     801        else: 
     802            self.cancelEvaluation = 1 
     803            self.cancelOptimization = 1 
     804 
     805 
     806    def optimizeBestProjections(self, restartWhenImproved = 1): 
     807        try: 
     808            self.startOptimizationButton.setText("Stop Optimization") 
     809 
    784810            self.disableControls() 
    785             evaluatedProjections = VizRank.evaluateProjections(self) 
     811            evaluatedProjections = VizRank.optimizeBestProjections(self, restartWhenImproved) 
    786812            self.enableControls() 
    787             self.parentWidget.progressBarFinished() 
    788813 
    789814            secs = time.time() - self.startTime 
     
    793818            if self.parentWidget: 
    794819                self.parentWidget.showSelectedAttributes() 
    795             self.startOptimizationButton.setText("Start Evaluating Projections") 
    796         else: 
    797             self.cancelEvaluation = 1 
    798             self.cancelOptimization = 1 
    799  
    800  
    801     def optimizeBestProjections(self, restartWhenImproved = 1): 
    802         self.startOptimizationButton.setText("Stop Optimization") 
    803  
    804         self.disableControls() 
    805         evaluatedProjections = VizRank.optimizeBestProjections(self, restartWhenImproved) 
    806         self.enableControls() 
    807  
    808         secs = time.time() - self.startTime 
    809         self.setStatusBarText("Finished evaluation (evaluated %s projections in %d min, %d sec)" % (orngVisFuncts.createStringFromNumber(evaluatedProjections), secs/60, secs%60)) 
    810         self.finishedAddingResults() 
    811         qApp.processEvents() 
    812         if self.parentWidget: 
    813             self.parentWidget.showSelectedAttributes() 
     820        except: 
     821            type, val, traceback = sys.exc_info() 
     822            sys.excepthook(type, val, traceback)  # print the exception 
    814823        self.startOptimizationButton.setText("Start Evaluating Projections") 
    815824 
     
    940949        OWGUI.checkBox(b3, self, 'sortAttributesByQuality', 'Sort attributes according to quality', callback = self.updateGraph, tooltip = "Do you want to show the attributes as they are ranked according to some quality measure\nor as they appear in the top ranked projections?") 
    941950 
    942         OWGUI.comboBox(b4, self, "rectColoring", tooltip = "What should darkness of color of rectangles represent?", items = ["(don't use color)", "projection quality", "frequency of occurence in projections"], callback = self.updateGraph) 
     951        OWGUI.comboBox(b4, self, "rectColoring", tooltip = "What should darkness of color of rectangles represent?", items = ["(don't use color)", "projection quality", "frequency of occurence in projections", "both"], callback = self.updateGraph) 
    943952 
    944953        OWGUI.checkBox(b5, self, "useGeneSets", label = "Use gene sets", callback = self.updateGraph) 
     
    10321041        attributes = [] 
    10331042        attrDict = {} 
     1043        countDict = {} 
     1044        bestDict = {} 
    10341045 
    10351046        if self.sortAttributesByQuality: 
     
    10561067 
    10571068                    # frequency of occurence 
    1058                     if self.rectColoring == 2: 
    1059                         attrDict[(Min, Max)] = attrDict.get((Min, Max), 0) + 1 
     1069                    countDict[(Min, Max)] = countDict.get((Min, Max), 0) + 1 
     1070 
    10601071                    # projection quality 
    1061                     elif not attrDict.has_key((Min, Max)): 
    1062                         attrDict[(Min, Max)] = self.results[index][self.ACCURACY] 
     1072                    if not bestDict.has_key((Min, Max)): 
     1073                        bestDict[(Min, Max)] = self.results[index][self.ACCURACY] 
    10631074            index += 1 
    10641075 
    1065         if self.rectColoring == 2: 
    1066             if attrDict.values() != []: best = max(attrDict.values()) 
    1067             else: best = 1 
    1068             worst = -1  # we could use 0 but those with 1 would be barely visible 
    1069         else: 
    1070             best = self.results[0][self.ACCURACY] 
    1071             worst= self.results[min(len(self.results)-1, self.projectionCount)][self.ACCURACY] 
     1076        bestCount = max([1] + countDict.values()) 
     1077        worstCount = -1  # we could use 0 but those with 1 would be barely visible 
     1078        bestAcc = self.results[0][self.ACCURACY] 
     1079        worstAcc= self.results[min(len(self.results)-1, self.projectionCount)][self.ACCURACY] 
    10721080 
    10731081        eps = 0.05 + 0.15 * self.useGeneSets 
     
    10781086            for y in range(num-x): 
    10791087                yy = num-y-1 
    1080  
    1081                 if attrDict.has_key((attributes[x], attributes[yy])): 
    1082                     val = attrDict[(attributes[x], attributes[yy])] 
    1083                 elif attrDict.has_key((attributes[yy], attributes[x])): 
    1084                     val = attrDict[(attributes[yy], attributes[x])] 
    1085                 else: 
     1088                countVal = None; bestVal = None 
     1089 
     1090                if countDict.has_key((attributes[x], attributes[yy])): 
     1091                    countVal = countDict[(attributes[x], attributes[yy])] 
     1092                elif countDict.has_key((attributes[yy], attributes[x])): 
     1093                    countVal = countDict[(attributes[yy], attributes[x])] 
     1094 
     1095                if bestDict.has_key((attributes[x], attributes[yy])): 
     1096                    accVal = bestDict[(attributes[x], attributes[yy])] 
     1097                elif bestDict.has_key((attributes[yy], attributes[x])): 
     1098                    accVal = bestDict[(attributes[yy], attributes[x])] 
     1099 
     1100                if countVal == bestVal == None: 
    10861101                    continue 
    10871102 
    1088                 if not self.rectColoring: 
     1103                if self.rectColoring == 0: 
    10891104                    color = black 
    1090                 else: 
    1091                     v = int(255 - 255*((val-worst)/float(best - worst))) 
     1105                elif self.rectColoring == 1: 
     1106                    v = int(255 - 255*((accVal-worstAcc)/float(bestAcc - worstAcc))) 
    10921107                    color = QColor(v,v,v) 
    1093  
    1094                 s = "" 
    1095                 if self.rectColoring == 1:  # projection quality 
    1096                     s = "Pair: <b>%s</b> and <b>%s</b><br>Best projection quality: <b>%.3f</b>" % (attributes[x], attributes[yy], val) 
    10971108                elif self.rectColoring == 2: 
    1098                     s = "Pair: <b>%s</b> and <b>%s</b><br>Number of appearances: <b>%d</b>" % (attributes[x], attributes[yy], val) 
     1109                    v = int(255 - 255*((countVal-worstCount)/float(bestCount - worstCount))) 
     1110                    color = QColor(v,v,v) 
     1111                elif self.rectColoring == 3: 
     1112                    v1 = int(255 - 255*((accVal-worstAcc)/float(bestAcc - worstAcc))) 
     1113                    v2 = int(255 - 255*((countVal-worstCount)/float(bestCount - worstCount))) 
     1114                    color1 = QColor(v1,v1,v1) 
     1115                    color2 = QColor(v2,v2,v2) 
     1116 
     1117                s = "Pair: <b>%s</b> and <b>%s</b>" % (attributes[x], attributes[yy]) 
     1118                if self.rectColoring in [1,3]:    # projection quality 
     1119                    s += "<br>Best projection quality: <b>%.3f</b>" % (accVal) 
     1120                if self.rectColoring in [2,3]:    # count 
     1121                    s += "<br>Number of appearances: <b>%d</b>" % (countVal) 
    10991122 
    11001123                sharedGeneSets = [] 
     
    11101133                    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])) 
    11111134 
    1112                 key = self.graph.insertCurve(RectangleCurve(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])) 
     1135                if self.rectColoring != 3: 
     1136                    self.graph.insertCurve(RectangleCurve(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])) 
     1137                else: 
     1138                    self.graph.insertCurve(PolygonCurve(self.graph, QPen(color1, 1), QBrush(color1), [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])) 
     1139                    self.graph.insertCurve(PolygonCurve(self.graph, QPen(color2, 1), QBrush(color2), [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])) 
    11131140 
    11141141                if self.useGeneSets and self.geneToSet and sharedGeneSets != []: 
    1115                     key = self.graph.insertCurve(RectangleCurve(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])) 
     1142                    self.graph.insertCurve(RectangleCurve(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])) 
    11161143                if s != "": 
    11171144                    self.graph.tips.addToolTip(x, y+1, s, 0.5, 0.5) 
    11181145 
    11191146                if not self.onlyLower: 
    1120                     key = self.graph.insertCurve(RectangleCurve(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])) 
     1147                    if self.rectColoring != 3: 
     1148                        self.graph.insertCurve(RectangleCurve(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])) 
     1149                    else: 
     1150                        self.graph.insertCurve(PolygonCurve(self.graph, QPen(color1, 1), QBrush(color1), [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])) 
     1151                        self.graph.insertCurve(PolygonCurve(self.graph, QPen(color2, 1), QBrush(color2), [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])) 
    11211152 
    11221153                    if self.useGeneSets and self.geneToSet and sharedGeneSets != []: 
    1123                         key = self.graph.insertCurve(RectangleCurve(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])) 
     1154                        self.graph.insertCurve(RectangleCurve(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])) 
    11241155                    if s != "": 
    11251156                        self.graph.tips.addToolTip(num-1-y, num-x, s, 0.5, 0.5) 
  • orange/OrangeWidgets/Visualize/OWLinProj.py

    r3483 r3700  
    338338    # receive new data and update all fields 
    339339    def setData(self, data): 
    340         if data and data.domain.classVar: 
     340        if data: 
    341341            name = getattr(data, "name", "") 
    342342            data = data.filterref(orange.Filter_hasClassValue()) 
    343343            data.name = name 
     344            if len(data) == 0 or len(data.domain) == 0:        # if we don't have any examples or attributes then this is not a valid data set 
     345                data = None 
    344346        if self.data and data and self.data.checksum() == data.checksum(): 
    345347            return    # check if the new data set is the same as the old one 
  • orange/OrangeWidgets/Visualize/OWParallelCoordinates.py

    r3567 r3700  
    243243    # receive new data and update all fields 
    244244    def setData(self, data): 
    245         if data and data.domain.classVar: 
     245        if data: 
    246246            name = getattr(data, "name", "") 
    247247            data = data.filterref(orange.Filter_hasClassValue()) 
    248248            data.name = name 
     249            if len(data) == 0 or len(data.domain) == 0:        # if we don't have any examples or attributes then this is not a valid data set 
     250                data = None 
    249251        if self.data != None and data != None and self.data.checksum() == data.checksum(): 
    250252            return    # check if the new data set is the same as the old one 
  • orange/OrangeWidgets/Visualize/OWScatterPlot.py

    r3483 r3700  
    1414from OWScatterPlotGraph import * 
    1515from OWkNNOptimization import * 
    16 import orngVizRank, OWExplorer 
     16import orngVizRank 
    1717##from OWClusterOptimization import * 
    1818import OWGUI, OWToolbars, OWDlgs 
     
    5454        self.vizrank = OWVizRank(self, self.signalManager, self.graph, orngVizRank.SCATTERPLOT, "ScatterPlot") 
    5555##        self.clusterDlg = ClusterOptimization(self, self.signalManager, self.graph, "ScatterPlot") 
    56         self.explorerDlg = OWExplorer.OWExplorerDialog(self, self.vizrank, "Scatterplot", signalManager) 
    5756        self.optimizationDlg = self.vizrank 
    5857 
     
    112111        self.optimizationButtons = OWGUI.widgetBox(self.GeneralTab, "Optimization Dialogs", orientation = "horizontal") 
    113112        OWGUI.button(self.optimizationButtons, self, "VizRank", callback = self.vizrank.reshow, tooltip = "Opens VizRank dialog, where you can search for interesting projections with different subsets of attributes.", debuggingEnabled = 0) 
    114         OWGUI.button(self.optimizationButtons, self, "Explorer", callback = self.explorerDlg.reshow, debuggingEnabled = 0, tooltip = "Select specific cells in mosaic and explore this data further.\nBuild a decision tree with mosaic diagrams.") 
     113         
    115114##        OWGUI.button(self.optimizationButtons, self, "Cluster", callback = self.clusterDlg.reshow, debuggingEnabled = 0) 
    116115##        self.connect(self.clusterDlg.startOptimizationButton , SIGNAL("clicked()"), self.optimizeClusters) 
     
    125124        # SETTINGS TAB 
    126125        # point width 
    127         OWGUI.hSlider(self.SettingsTab, self, 'graph.pointWidth', box=' Point Size ', minValue=1, maxValue=20, step=1, callback = self.replotCurves) 
     126        OWGUI.hSlider(self.SettingsTab, self, 'graph.pointWidth', box=' Point Size ', minValue=1, maxValue=20, step=1, callback = self.pointSizeChange) 
    128127 
    129128        # ##### 
     
    223222            data = data.filterref(orange.Filter_hasClassValue()) 
    224223            data.name = name 
     224            if len(data) == 0 or len(data.domain) == 0:        # if we don't have any examples or attributes then this is not a valid data set 
     225                data = None 
    225226        if self.data != None and data != None and self.data.checksum() == data.checksum(): 
    226227            return    # check if the new data set is the same as the old one 
     
    237238 
    238239        self.vizrank.setData(data) 
    239         self.explorerDlg.setData(self.data) 
    240240##        self.clusterDlg.setData(data, clearResults) 
    241241 
     
    431431        self.graph.updateData(self.attrX, self.attrY, self.attrColor, self.attrShape, self.attrSize, self.showColorLegend, self.attrLabel) 
    432432        self.graph.repaint() 
    433         self.explorerDlg.updateState() 
    434433 
    435434 
     
    443442        self.progressBar.setProgress(current) 
    444443 
     444    def pointSizeChange(self): 
     445        if self.attrSize == "": 
     446            self.replotCurves() 
     447        else: 
     448            self.updateGraph() 
    445449 
    446450    def replotCurves(self): 
     
    455459 
    456460    def setAutoSendSelection(self): 
    457         self.explorerDlg.updateState() 
    458461        if self.autoSendSelection: 
    459462            self.zoomSelectToolbar.buttonSendSelections.setEnabled(0) 
  • orange/OrangeWidgets/Visualize/OWSurveyPlot.py

    r3548 r3700  
    99# 
    1010# Show data using survey plot visualization method 
    11 #  
     11# 
    1212 
    1313from OWVisWidget import * 
     
    1616import orngVisFuncts 
    1717import OWGUI 
    18             
     18 
    1919########################################################################################### 
    2020##### WIDGET : Survey plot visualization 
     
    9090        self.icons = self.createAttributeIconDict() 
    9191 
    92         # add a settings dialog and initialize its values         
     92        # add a settings dialog and initialize its values 
    9393        self.activateLoadedSettings() 
    9494        self.resize(700,700) 
    9595 
    96         # this is needed so that the tabs are wide enough!  
     96        # this is needed so that the tabs are wide enough! 
    9797        qApp.processEvents() 
    9898        self.tabs.updateGeometry() 
     
    107107        self.graph.setCanvasBackground(dlg.getColor("Canvas")) 
    108108        self.graph.setGridPen(QPen(dlg.getColor("Grid"))) 
    109          
     109 
    110110        #self.graph.setCanvasBackground(QColor(self.graphCanvasColor)) 
    111111        self.cbShowAllAttributes() 
     
    125125        self.primaryAttribute = "(None)" 
    126126        self.secondaryAttribute = "(None)" 
    127      
     127 
    128128    def updateGraph(self, *args): 
    129129        self.graph.updateData(self.getShownAttributeList()) 
     
    139139 
    140140        self.graph.setData(self.data, sortValuesForDiscreteAttrs = 0) 
    141         self.updateGraph()         
    142          
    143     
     141        self.updateGraph() 
     142 
     143 
    144144    # receive new data and update all fields 
    145145    def setData(self, data): 
     
    148148            data = data.filterref(orange.Filter_hasClassValue()) 
    149149            data.name = name 
     150            if len(data) == 0 or len(data.domain) == 0:        # if we don't have any examples or attributes then this is not a valid data set 
     151                data = None 
    150152        if self.data != None and data != None and self.data.checksum() == data.checksum(): 
    151153            return    # check if the new data set is the same as the old one 
     
    153155        exData = self.data 
    154156        self.data = data 
    155          
     157 
    156158        sameDomain = self.data and exData and exData.domain.checksum() == self.data.domain.checksum() # preserve attribute choice if the domain is the same 
    157159        if not sameDomain: 
     
    227229    a.exec_loop() 
    228230 
    229     #save settings  
     231    #save settings 
    230232    ow.saveSettings() 
Note: See TracChangeset for help on using the changeset viewer.