def reDraw(self, newData, newData2=[]): self.data = newData if len(newData2) > 0: self.data2 = newData2 self.doubleBox = True self.min2 = SummaryCalcs.minimum(self.data2) self.q12 = SummaryCalcs.quar1(self.data2) self.mean2 = SummaryCalcs.mean(self.data2) self.q32 = SummaryCalcs.quar3(self.data2) self.max2 = SummaryCalcs.maximum(self.data2) else: self.doubleBox = False self.min = SummaryCalcs.minimum(self.data) self.q1 = SummaryCalcs.quar1(self.data) self.mean = SummaryCalcs.mean(self.data) self.q3 = SummaryCalcs.quar3(self.data) self.max = SummaryCalcs.maximum(self.data) self.scale = self.calcScale() if self.doubleBox: if self.min - self.min2 > 0: self.lower = 1 else: self.lower = 2 if self.max - self.max2 > 0: self.higher = 1 else: self.higher = 2 self.parent.delete("all") self.draw_plot()
def FindBinWidth(self): dataMin = int(SummaryCalcs.minimum(self.data)) dataMax = int(SummaryCalcs.maximum(self.data)) dataRange = dataMax - dataMin binWidth = 1 if dataRange <= 10: maxBins = 3 binInc = 1 else: maxBins = 10 binInc = 5 numToDiv = int(dataRange/binWidth) while numToDiv > maxBins: binWidth += binInc numToDiv = int(dataRange/binWidth) self.binWidth = binWidth #generate bin array binArray = [] binVal = 0 while (len(binArray) == 0) or (binArray[-1] <= dataMax): if len(binArray) == 0: if binVal <= dataMin < binVal+binWidth: binArray.append(binVal) binVal += binWidth else: binVal += binWidth else: binArray.append(binVal) binVal += binWidth self.binArray = binArray
def __init__(self, master, data, data2=[], master_size=[640, 640], color="black", color2="black", axisColor="black", bufferZone=[20, 20]): self.parent = master self.master_size = master_size self.color = color self.color2 = color2 self.axisColor = axisColor self.bufferZone = bufferZone self.bufferZone2 = [bufferZone[0], bufferZone[1]+70] self.data = data if len(data2) > 0: self.data2 = data2 self.doubleBox = True self.min2 = SummaryCalcs.minimum(self.data2) self.q12 = SummaryCalcs.quar1(self.data2) self.mean2 = SummaryCalcs.mean(self.data2) self.q32 = SummaryCalcs.quar3(self.data2) self.max2 = SummaryCalcs.maximum(self.data2) else: self.doubleBox = False self.min = SummaryCalcs.minimum(self.data) self.q1 = SummaryCalcs.quar1(self.data) self.mean = SummaryCalcs.mean(self.data) self.q3 = SummaryCalcs.quar3(self.data) self.max = SummaryCalcs.maximum(self.data) self.scale = self.calcScale() if self.doubleBox: if self.min - self.min2 > 0: self.lower = 1 else: self.lower = 2 if self.max - self.max2 > 0: self.higher = 1 else: self.higher = 2 self.draw_plot()