def DrawHistograms(self, statistics): """Draw histograms for one class :param statistics: statistics for one class """ self.histogramLines = [] for bandIdx in range(len(self.bandList)): self.canvasList[bandIdx].Clear() self.canvasList[bandIdx].SetYSpec(type='auto') histgramLine = self.CreateHistogramLine( bandValues=statistics.bands[bandIdx]) meanLine = self.CreateMean(bandValues=statistics.bands[bandIdx]) minLine = self.CreateMin(bandValues=statistics.bands[bandIdx]) maxLine = self.CreateMax(bandValues=statistics.bands[bandIdx]) self.histogramLines.append( [histgramLine, meanLine, minLine, maxLine]) maxRangeLine = self.CreateMaxRange( bandValues=statistics.bands[bandIdx]) minRangeLine = self.CreateMinRange( bandValues=statistics.bands[bandIdx]) plotGraph = plot.PlotGraphics(self.histogramLines[bandIdx] + [minRangeLine, maxRangeLine], title=self.bandList[bandIdx]) self.canvasList[bandIdx].Draw(plotGraph)
def DrawCoincidencePlots(self): """Draw coincidence plots""" for bandIdx in range(len(self.bandList)): self.canvasList[bandIdx].SetYSpec(type='none') lines = [] level = 0.5 lines.append(self.DrawInvisibleLine(level)) cats = self.stats_data.GetCategories() for i, cat in enumerate(cats): stat = self.stats_data.GetStatistics(cat) if not stat.IsReady(): continue color = stat.color level = i + 1 line = self.DrawCoincidenceLine(level, color, stat.bands[bandIdx]) lines.append(line) # invisible level += 0.5 lines.append(self.DrawInvisibleLine(level)) plotGraph = plot.PlotGraphics(lines, title=self.bandList[bandIdx]) self.canvasList[bandIdx].Draw(plotGraph)
def UpdateRanges(self, statistics): """Redraw ranges lines in histograms when std dev multiplier changes :param statistics: python Statistics instance """ for bandIdx in range(len(self.bandList)): self.canvasList[bandIdx].Clear() maxRangeLine = self.CreateMaxRange( bandValues=statistics.bands[bandIdx]) minRangeLine = self.CreateMinRange( bandValues=statistics.bands[bandIdx]) plotGraph = plot.PlotGraphics(self.histogramLines[bandIdx] + [minRangeLine, maxRangeLine], title=self.bandList[bandIdx]) self.canvasList[bandIdx].Draw(plotGraph)
def DrawPlot(self, plotlist): """Draw line and point plot from list plot elements. """ xlabel, ylabel = self._getPlotLabels() self.plot = plot.PlotGraphics(plotlist, self.ptitle, xlabel, ylabel) if self.properties['x-axis']['prop']['type'] == 'custom': self.client.SetXSpec('min') else: self.client.SetXSpec(self.properties['x-axis']['prop']['type']) if self.properties['y-axis']['prop']['type'] == 'custom': self.client.SetYSpec('min') else: self.client.SetYSpec(self.properties['y-axis']['prop']['type']) self.client.Draw(self.plot, self.properties['x-axis']['axis'], self.properties['y-axis']['axis'])