def plotRug(self, noUpdate=False): for rug in self.rugKeys: rug.detach() self.rugKeys = [] if self.master.showRug: targetClass = self.master.targetClass if self.contingency: freqhigh = [ (val, freq[targetClass]) for val, freq in self.contingency.items() if freq[targetClass] > 1e-6 ] freqlow = [(val, freq.abs - freq[targetClass]) for val, freq in self.contingency.items()] freqlow = [f for f in freqlow if f[1] > 1e-6] elif self.probDist: freqhigh = [] freqlow = self.probDist.items() else: return if freqhigh: maxf = max([f[1] for f in freqhigh]) if freqlow: maxf = max(maxf, max([f[1] for f in freqlow])) elif freqlow: maxf = max([f[1] for f in freqlow]) else: return freqfac = maxf > 1e-6 and 0.1 / maxf or 1 xData = sum(([val, val] for val, freq in freqhigh), []) + sum(([val, val] for val, freq in freqlow), []) yData = sum(([1.0, 1.0 - max(0.02, freqfac * freq)] for val, freq in freqhigh), []) + sum( ([0.04, 0.04 + max(0.02, freqfac * freq)] for val, freq in freqlow), [] ) c = UnconnectedLinesCurve("rug", xData=xData, yData=yData) c.set_auto_scale(True) c.set_y_axis(yRight) self.add_custom_curve(c) self.rugKeys.append(c) if not noUpdate: self.replot()
def plotRug(self, noUpdate = False): for rug in self.rugKeys: rug.detach() self.rugKeys = [] if self.master.showRug: targetClass = self.master.targetClass if self.contingency: freqhigh = [(val, freq[targetClass]) for val, freq in self.contingency.items() if freq[targetClass] > 1e-6] freqlow = [(val, freq.abs - freq[targetClass]) for val, freq in self.contingency.items()] freqlow = [f for f in freqlow if f[1] > 1e-6] elif self.probDist: freqhigh = [] freqlow = self.probDist.items() else: return if freqhigh: maxf = max([f[1] for f in freqhigh]) if freqlow: maxf = max(maxf, max([f[1] for f in freqlow])) elif freqlow: maxf = max([f[1] for f in freqlow]) else: return freqfac = maxf > 1e-6 and .1 / maxf or 1 xData = sum(([val, val] for val, freq in freqhigh), []) + sum(([val, val] for val, freq in freqlow), []) yData = sum(([1.0, 1.0 - max(0.02, freqfac * freq)] for val, freq in freqhigh), []) + sum(([0.04, 0.04 + max(.02, freqfac * freq)] for val, freq in freqlow), []) c = UnconnectedLinesCurve('rug', xData = xData, yData = yData) c.set_auto_scale(True) c.set_y_axis(yRight) self.add_custom_curve(c) self.rugKeys.append(c) if not noUpdate: self.replot()
def updateData(self, labels = None, setAnchors = 0, **args): for c in self._extra_curves: c.detach() self._extra_curves = [] self.tooltipMarkers = [] for c in self.value_line_curves: c.detach() self.value_line_curves = [] self.legend().clear() self.clear_markers() self.__dict__.update(args) if labels == None: labels = [anchor[2] for anchor in self.anchorData] self.shownAttributes = labels self.dataMap = {} # dictionary with keys of form "x_i-y_i" with values (x_i, y_i, color, data) self.valueLineCurves = [{}, {}] # dicts for x and y set of coordinates for unconnected lines if not self.haveData or len(labels) < 3: self.anchorData = [] self.updateLayout() return if setAnchors or (args.has_key("XAnchors") and args.has_key("YAnchors")): self.potentialsBmp = None self.setAnchors(args.get("XAnchors"), args.get("YAnchors"), labels) #self.anchorData = self.createAnchors(len(labels), labels) # used for showing tooltips indices = [self.attributeNameIndex[anchor[2]] for anchor in self.anchorData] # store indices to shown attributes # do we want to show anchors and their labels if self.showAnchors: if self.hideRadius > 0: circle = CircleCurve(QColor(200,200,200), QColor(200,200,200), radius = self.hideRadius) circle.ignore_alpha = True self.add_custom_curve(circle) self._extra_curves.append(circle) # draw dots at anchors shownAnchorData = filter(lambda p, r=self.hideRadius**2/100: p[0]**2+p[1]**2>r, self.anchorData) self.remove_all_axes(user_only = False) if not self.normalizeExamples: r=self.hideRadius**2/100 for i,(x,y,a) in enumerate(shownAnchorData): if x > 0: line = QLineF(0, 0, x, y) arrows = AxisEnd label_pos = AxisEnd else: line = QLineF(x, y, 0, 0) arrows = AxisStart label_pos = AxisStart self.add_axis(UserAxis + i, title=a, title_location=label_pos, line=line, arrows=arrows, zoomable=True) self.setAxisLabels(UserAxis + i, []) else: XAnchors = [a[0] for a in shownAnchorData] YAnchors = [a[1] for a in shownAnchorData] c = self.addCurve("dots", QColor(160,160,160), QColor(160,160,160), 10, style = Qt.NoPen, symbol = OWPoint.Ellipse, xData = XAnchors, yData = YAnchors, showFilledSymbols = 1) c.ignore_alpha = True self._extra_curves.append(c) # draw text at anchors if self.showAttributeNames: for x, y, a in shownAnchorData: self.addMarker(a, x*1.07, y*1.04, Qt.AlignCenter, bold = 1) if self.showAnchors and self.normalizeExamples: # draw "circle" circle = CircleCurve() circle.ignore_alpha = True self.add_custom_curve(circle) self._extra_curves.append(circle) self.potentialsClassifier = None # remove the classifier so that repaint won't recompute it self.updateLayout() if self.dataHasDiscreteClass: self.discPalette.setNumberOfColors(len(self.dataDomain.classVar.values)) useDifferentSymbols = self.useDifferentSymbols and self.dataHasDiscreteClass and len(self.dataDomain.classVar.values) < len(self.curveSymbols) dataSize = len(self.rawData) validData = self.getValidList(indices) transProjData = self.createProjectionAsNumericArray(indices, validData = validData, scaleFactor = self.scaleFactor, normalize = self.normalizeExamples, jitterSize = -1, useAnchorData = 1, removeMissingData = 0) if transProjData == None: return projData = transProjData.T x_positions = projData[0] y_positions = projData[1] xPointsToAdd = {} yPointsToAdd = {} if self.potentialsCurve: self.potentialsCurve.detach() self.potentialsCurve = None if self.showProbabilities and self.haveData and self.dataHasClass: # construct potentialsClassifier from unscaled positions domain = orange.Domain([self.dataDomain[i].name for i in indices]+[self.dataDomain.classVar.name], self.dataDomain) offsets = [self.attrValues[self.attributeNames[i]][0] for i in indices] normalizers = [self.getMinMaxVal(i) for i in indices] selectedData = numpy.take(self.originalData, indices, axis = 0) averages = numpy.average(numpy.compress(validData, selectedData, axis=1), 1) classData = numpy.compress(validData, self.originalData[self.dataClassIndex]) if classData.any(): self.potentialsClassifier = orange.P2NN(domain, numpy.transpose(numpy.array([numpy.compress(validData, self.unscaled_x_positions), numpy.compress(validData, self.unscaled_y_positions), classData])), self.anchorData, offsets, normalizers, averages, self.normalizeExamples, law=1) self.potentialsCurve = ProbabilitiesItem(self.potentialsClassifier, self.squareGranularity, self.trueScaleFactor/2, self.spaceBetweenCells, QRectF(-1, -1, 2, 2)) self.potentialsCurve.attach(self) else: self.potentialsClassifier = None self.potentialsImage = None if self.useDifferentColors: if self.dataHasDiscreteClass: color_data = [QColor(*self.discPalette.getRGB(i)) for i in self.originalData[self.dataClassIndex]] elif self.dataHasContinuousClass: color_data = [QColor(*self.contPalette.getRGB(i)) for i in self.originalData[self.dataClassIndex]] else: color_data = [Qt.black] else: color_data = [Qt.black] if self.useDifferentSymbols and self.dataHasDiscreteClass: symbol_data = [self.curveSymbols[int(i)] for i in self.originalData[self.dataClassIndex]] else: symbol_data = [OWPoint.Ellipse] size_data = [self.point_width] label_data = [] if self.haveSubsetData: subset_ids = [example.id for example in self.rawSubsetData] marked_data = [example.id in subset_ids for example in self.rawData] showFilled = 0 else: marked_data = [] self.set_main_curve_data(x_positions, y_positions, color_data, label_data, size_data, symbol_data, marked_data, validData) # ############################################################## # show model quality # ############################################################## if self.insideColors != None or self.showKNN and self.haveData: # if we want to show knn classifications of the examples then turn the projection into example table and run knn if self.insideColors: insideData, stringData = self.insideColors else: shortData = self.createProjectionAsExampleTable([self.attributeNameIndex[attr] for attr in labels], useAnchorData = 1) predictions, probabilities = self.widget.vizrank.kNNClassifyData(shortData) if self.showKNN == 2: insideData, stringData = [1.0 - val for val in predictions], "Probability of wrong classification = %.2f%%" else: insideData, stringData = predictions, "Probability of correct classification = %.2f%%" if self.dataHasDiscreteClass: classColors = self.discPalette elif self.dataHasContinuousClass: classColors = self.contPalette if len(insideData) != len(self.rawData): j = 0 for i in range(len(self.rawData)): if not validData[i]: continue if self.dataHasClass: fillColor = classColors.getRGB(self.originalData[self.dataClassIndex][i], 255*insideData[j]) edgeColor = classColors.getRGB(self.originalData[self.dataClassIndex][i]) else: fillColor = edgeColor = (0,0,0) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], edgeColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*edgeColor), i, stringData % (100*insideData[j])) j+= 1 else: for i in range(len(self.rawData)): if not validData[i]: continue if self.dataHasClass: fillColor = classColors.getRGB(self.originalData[self.dataClassIndex][i], 255*insideData[i]) edgeColor = classColors.getRGB(self.originalData[self.dataClassIndex][i]) else: fillColor = edgeColor = (0,0,0) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], edgeColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*edgeColor), i, stringData % (100*insideData[i])) # ############################################################## # do we have a subset data to show? # ############################################################## elif self.haveSubsetData: shownSubsetCount = 0 subsetIdsToDraw = dict([(example.id,1) for example in self.rawSubsetData]) # draw the rawData data set. examples that exist also in the subset data draw full, other empty for i in range(dataSize): if not validData[i]: continue if subsetIdsToDraw.has_key(self.rawData[i].id): continue if self.dataHasDiscreteClass and self.useDifferentColors: newColor = self.discPalette.getRGB(self.originalData[self.dataClassIndex][i]) elif self.dataHasContinuousClass and self.useDifferentColors: newColor = self.contPalette.getRGB(self.noJitteringScaledData[self.dataClassIndex][i]) else: newColor = (0,0,0) if self.useDifferentSymbols and self.dataHasDiscreteClass: curveSymbol = self.curveSymbols[int(self.originalData[self.dataClassIndex][i])] else: curveSymbol = self.curveSymbols[0] if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], newColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*newColor), i) elif not self.dataHasClass: xs = []; ys = [] for i in range(dataSize): if not validData[i]: continue xs.append(x_positions[i]) ys.append(y_positions[i]) self.addTooltipKey(x_positions[i], y_positions[i], QColor(Qt.black), i) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], (0,0,0), i, indices) # ############################################################## # CONTINUOUS class # ############################################################## elif self.dataHasContinuousClass: for i in range(dataSize): if not validData[i]: continue newColor = self.contPalette.getRGB(self.noJitteringScaledData[self.dataClassIndex][i]) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], newColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*newColor), i) # ############################################################## # DISCRETE class # ############################################################## elif self.dataHasDiscreteClass: for i in range(dataSize): if not validData[i]: continue if self.useDifferentColors: newColor = self.discPalette.getRGB(self.originalData[self.dataClassIndex][i]) else: newColor = (0,0,0) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], newColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*newColor), i) # first draw value lines if self.showValueLines: for i, color in enumerate(self.valueLineCurves[0].keys()): curve = UnconnectedLinesCurve("", QPen(QColor(*color + (self.alphaValue,))), self.valueLineCurves[0][color], self.valueLineCurves[1][color]) curve.attach(self) self.value_line_curves.append(curve) # ############################################################## # draw the legend # ############################################################## # show legend for discrete class if self.dataHasDiscreteClass: classVariableValues = getVariableValuesSorted(self.dataDomain.classVar) for index in range(len(classVariableValues)): if self.useDifferentColors: color = QColor(self.discPalette[index]) else: color = QColor(Qt.black) if not self.useDifferentSymbols: curveSymbol = self.curveSymbols[0] else: curveSymbol = self.curveSymbols[index] self.legend().add_item(self.dataDomain.classVar.name, classVariableValues[index], OWPoint(curveSymbol, color, self.pointWidth)) # show legend for continuous class elif self.dataHasContinuousClass: self.legend().add_color_gradient(self.dataDomain.classVar.name, [("%%.%df" % self.dataDomain.classVar.numberOfDecimals % v) for v in self.attrValues[self.dataDomain.classVar.name]]) self.replot()
def updateData(self, labels=None, setAnchors=0, **args): for c in self._extra_curves: c.detach() self._extra_curves = [] self.tooltipMarkers = [] for c in self.value_line_curves: c.detach() self.value_line_curves = [] self.legend().clear() self.clear_markers() self.__dict__.update(args) if labels == None: labels = [anchor[2] for anchor in self.anchorData] self.shownAttributes = labels self.dataMap = { } # dictionary with keys of form "x_i-y_i" with values (x_i, y_i, color, data) self.valueLineCurves = [ {}, {} ] # dicts for x and y set of coordinates for unconnected lines if not self.haveData or len(labels) < 3: self.anchorData = [] self.updateLayout() return if setAnchors or (args.has_key("XAnchors") and args.has_key("YAnchors")): self.potentialsBmp = None self.setAnchors(args.get("XAnchors"), args.get("YAnchors"), labels) #self.anchorData = self.createAnchors(len(labels), labels) # used for showing tooltips indices = [ self.attributeNameIndex[anchor[2]] for anchor in self.anchorData ] # store indices to shown attributes # do we want to show anchors and their labels if self.showAnchors: if self.hideRadius > 0: circle = CircleCurve(QColor(200, 200, 200), QColor(200, 200, 200), radius=self.hideRadius) circle.ignore_alpha = True self.add_custom_curve(circle) self._extra_curves.append(circle) # draw dots at anchors shownAnchorData = filter( lambda p, r=self.hideRadius**2 / 100: p[0]**2 + p[1]**2 > r, self.anchorData) self.remove_all_axes(user_only=False) if not self.normalizeExamples: r = self.hideRadius**2 / 100 for i, (x, y, a) in enumerate(shownAnchorData): if x > 0: line = QLineF(0, 0, x, y) arrows = AxisEnd label_pos = AxisEnd else: line = QLineF(x, y, 0, 0) arrows = AxisStart label_pos = AxisStart self.add_axis(UserAxis + i, title=a, title_location=label_pos, line=line, arrows=arrows, zoomable=True) self.setAxisLabels(UserAxis + i, []) else: XAnchors = [a[0] for a in shownAnchorData] YAnchors = [a[1] for a in shownAnchorData] c = self.addCurve("dots", QColor(160, 160, 160), QColor(160, 160, 160), 10, style=Qt.NoPen, symbol=OWPoint.Ellipse, xData=XAnchors, yData=YAnchors, showFilledSymbols=1) c.ignore_alpha = True self._extra_curves.append(c) # draw text at anchors if self.showAttributeNames: for x, y, a in shownAnchorData: self.addMarker(a, x * 1.07, y * 1.04, Qt.AlignCenter, bold=1) if self.showAnchors and self.normalizeExamples: # draw "circle" circle = CircleCurve() circle.ignore_alpha = True self.add_custom_curve(circle) self._extra_curves.append(circle) self.potentialsClassifier = None # remove the classifier so that repaint won't recompute it self.updateLayout() if self.dataHasDiscreteClass: self.discPalette.setNumberOfColors( len(self.dataDomain.classVar.values)) useDifferentSymbols = self.useDifferentSymbols and self.dataHasDiscreteClass and len( self.dataDomain.classVar.values) < len(self.curveSymbols) dataSize = len(self.rawData) validData = self.getValidList(indices) transProjData = self.createProjectionAsNumericArray( indices, validData=validData, scaleFactor=self.scaleFactor, normalize=self.normalizeExamples, jitterSize=-1, useAnchorData=1, removeMissingData=0) if transProjData == None: return projData = transProjData.T x_positions = projData[0] y_positions = projData[1] xPointsToAdd = {} yPointsToAdd = {} if self.potentialsCurve: self.potentialsCurve.detach() self.potentialsCurve = None if self.showProbabilities and self.haveData and self.dataHasClass: # construct potentialsClassifier from unscaled positions domain = orange.Domain([self.dataDomain[i].name for i in indices] + [self.dataDomain.classVar.name], self.dataDomain) offsets = [ self.attrValues[self.attributeNames[i]][0] for i in indices ] normalizers = [self.getMinMaxVal(i) for i in indices] selectedData = numpy.take(self.originalData, indices, axis=0) averages = numpy.average( numpy.compress(validData, selectedData, axis=1), 1) classData = numpy.compress(validData, self.originalData[self.dataClassIndex]) if classData.any(): self.potentialsClassifier = orange.P2NN( domain, numpy.transpose( numpy.array([ numpy.compress(validData, self.unscaled_x_positions), numpy.compress(validData, self.unscaled_y_positions), classData ])), self.anchorData, offsets, normalizers, averages, self.normalizeExamples, law=1) self.potentialsCurve = ProbabilitiesItem( self.potentialsClassifier, self.squareGranularity, self.trueScaleFactor / 2, self.spaceBetweenCells, QRectF(-1, -1, 2, 2)) self.potentialsCurve.attach(self) else: self.potentialsClassifier = None self.potentialsImage = None if self.useDifferentColors: if self.dataHasDiscreteClass: color_data = [ QColor(*self.discPalette.getRGB(i)) for i in self.originalData[self.dataClassIndex] ] elif self.dataHasContinuousClass: color_data = [ QColor(*self.contPalette.getRGB(i)) for i in self.originalData[self.dataClassIndex] ] else: color_data = [Qt.black] else: color_data = [Qt.black] if self.useDifferentSymbols and self.dataHasDiscreteClass: symbol_data = [ self.curveSymbols[int(i)] for i in self.originalData[self.dataClassIndex] ] else: symbol_data = [OWPoint.Ellipse] size_data = [self.point_width] label_data = [] if self.haveSubsetData: subset_ids = [example.id for example in self.rawSubsetData] marked_data = [ example.id in subset_ids for example in self.rawData ] showFilled = 0 else: marked_data = [] self.set_main_curve_data(x_positions, y_positions, color_data, label_data, size_data, symbol_data, marked_data, validData) # ############################################################## # show model quality # ############################################################## if self.insideColors != None or self.showKNN and self.haveData: # if we want to show knn classifications of the examples then turn the projection into example table and run knn if self.insideColors: insideData, stringData = self.insideColors else: shortData = self.createProjectionAsExampleTable( [self.attributeNameIndex[attr] for attr in labels], useAnchorData=1) predictions, probabilities = self.widget.vizrank.kNNClassifyData( shortData) if self.showKNN == 2: insideData, stringData = [ 1.0 - val for val in predictions ], "Probability of wrong classification = %.2f%%" else: insideData, stringData = predictions, "Probability of correct classification = %.2f%%" if self.dataHasDiscreteClass: classColors = self.discPalette elif self.dataHasContinuousClass: classColors = self.contPalette if len(insideData) != len(self.rawData): j = 0 for i in range(len(self.rawData)): if not validData[i]: continue if self.dataHasClass: fillColor = classColors.getRGB( self.originalData[self.dataClassIndex][i], 255 * insideData[j]) edgeColor = classColors.getRGB( self.originalData[self.dataClassIndex][i]) else: fillColor = edgeColor = (0, 0, 0) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], edgeColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*edgeColor), i, stringData % (100 * insideData[j])) j += 1 else: for i in range(len(self.rawData)): if not validData[i]: continue if self.dataHasClass: fillColor = classColors.getRGB( self.originalData[self.dataClassIndex][i], 255 * insideData[i]) edgeColor = classColors.getRGB( self.originalData[self.dataClassIndex][i]) else: fillColor = edgeColor = (0, 0, 0) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], edgeColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*edgeColor), i, stringData % (100 * insideData[i])) # ############################################################## # do we have a subset data to show? # ############################################################## elif self.haveSubsetData: shownSubsetCount = 0 subsetIdsToDraw = dict([(example.id, 1) for example in self.rawSubsetData]) # draw the rawData data set. examples that exist also in the subset data draw full, other empty for i in range(dataSize): if not validData[i]: continue if subsetIdsToDraw.has_key(self.rawData[i].id): continue if self.dataHasDiscreteClass and self.useDifferentColors: newColor = self.discPalette.getRGB( self.originalData[self.dataClassIndex][i]) elif self.dataHasContinuousClass and self.useDifferentColors: newColor = self.contPalette.getRGB( self.noJitteringScaledData[self.dataClassIndex][i]) else: newColor = (0, 0, 0) if self.useDifferentSymbols and self.dataHasDiscreteClass: curveSymbol = self.curveSymbols[int( self.originalData[self.dataClassIndex][i])] else: curveSymbol = self.curveSymbols[0] if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], newColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*newColor), i) elif not self.dataHasClass: xs = [] ys = [] for i in range(dataSize): if not validData[i]: continue xs.append(x_positions[i]) ys.append(y_positions[i]) self.addTooltipKey(x_positions[i], y_positions[i], QColor(Qt.black), i) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], (0, 0, 0), i, indices) # ############################################################## # CONTINUOUS class # ############################################################## elif self.dataHasContinuousClass: for i in range(dataSize): if not validData[i]: continue newColor = self.contPalette.getRGB( self.noJitteringScaledData[self.dataClassIndex][i]) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], newColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*newColor), i) # ############################################################## # DISCRETE class # ############################################################## elif self.dataHasDiscreteClass: for i in range(dataSize): if not validData[i]: continue if self.useDifferentColors: newColor = self.discPalette.getRGB( self.originalData[self.dataClassIndex][i]) else: newColor = (0, 0, 0) if self.showValueLines: self.addValueLineCurve(x_positions[i], y_positions[i], newColor, i, indices) self.addTooltipKey(x_positions[i], y_positions[i], QColor(*newColor), i) # first draw value lines if self.showValueLines: for i, color in enumerate(self.valueLineCurves[0].keys()): curve = UnconnectedLinesCurve( "", QPen(QColor(*color + (self.alphaValue, ))), self.valueLineCurves[0][color], self.valueLineCurves[1][color]) curve.attach(self) self.value_line_curves.append(curve) # ############################################################## # draw the legend # ############################################################## # show legend for discrete class if self.dataHasDiscreteClass: classVariableValues = getVariableValuesSorted( self.dataDomain.classVar) for index in range(len(classVariableValues)): if self.useDifferentColors: color = QColor(self.discPalette[index]) else: color = QColor(Qt.black) if not self.useDifferentSymbols: curveSymbol = self.curveSymbols[0] else: curveSymbol = self.curveSymbols[index] self.legend().add_item( self.dataDomain.classVar.name, classVariableValues[index], OWPoint(curveSymbol, color, self.pointWidth)) # show legend for continuous class elif self.dataHasContinuousClass: self.legend().add_color_gradient( self.dataDomain.classVar.name, [("%%.%df" % self.dataDomain.classVar.numberOfDecimals % v) for v in self.attrValues[self.dataDomain.classVar.name]]) self.replot()
def showAnchorLines(self): for i, color in enumerate(self.xLinesToAdd.keys()): curve = UnconnectedLinesCurve("", QPen(QColor(*color)), self.xLinesToAdd[color], self.yLinesToAdd[color]) curve.attach(self)