def _visualizeHistogram(self, e=None): views = [] self.isComputed() numberOfBins = self.visualizeHistogram.get() numberOfBins = min(numberOfBins, self.setOfCTFsConst.getSize()) plotter = EmPlotter() plotter.createSubPlot("Resolution Discrepancies histogram", "Resolution (A)", "# of Comparisons") resolution = [ctf.resolution.get() for ctf in self.setOfCTFsConst] plotter.plotHist(resolution, nbins=numberOfBins) return views.append(plotter)
def _visualizeHistogram(self, e=None): views = [] numberOfBins = self.visualizeHistogram.get() numberOfBins = min(numberOfBins, self.protocol.outputCTF.getSize()) plotter = EmPlotter() plotter.createSubPlot("Resolution Discrepancies histogram", "Resolution (A)", "# of Comparisons") resolution = [ctf.getResolution() for ctf in self.protocol.outputCTF] plotter.plotHist(resolution, nbins=numberOfBins) # ROB: why do I need this show? plotter.show() return views.append(plotter)
def _plotHistogram(self, param=None): imageFile = self.protocol._getFileName(FN_RESOLMAP) img = ImageHandler().read(imageFile) imgData = img.getData() imgList = imgData.flatten() imgListNoZero = filter(lambda x: x > 0, imgList) nbins = 30 plotter = EmPlotter(x=1, y=1, mainTitle=" ") plotter.createSubPlot("Resolution histogram", "Resolution (A)", "# of Counts") fig = plotter.plotHist(imgListNoZero, nbins) return [plotter]
def _onPlotClick(self, e=None): selection = self.tree.selection() n = len(selection) if n < 1 or n > 2: self.showError("Select one or two variables to plot.") else: plotter = EmPlotter() varX = self._variables[selection[0]] xValues = self.observations[:, varX.index] def _label(var): return "%s [%s]" % (var.varName, var.unitStr) if n == 1: plotter.createSubPlot("Histogram", _label(varX), "Count") plotter.plotHist(xValues, 50) else: # n == 2 varY = self._variables[selection[1]] yValues = self.observations[:, varY.index] ax = plotter.createSubPlot("Scatter Plot", _label(varX), _label(varY)) ax.plot(xValues, yValues, '.') plotter.show()