def _addBoundTree(self, parent, ProviderClass, height, **kwargs): bt = BoundTree(parent, ProviderClass(self.experiment, **kwargs), height=height) bt.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(parent) return bt
def _fillTreeFrame(self, frame): self.tree = BoundTree(frame, self.provider) self.tree.grid(row=0, column=0) self.updateVar = tk.StringVar() updateLabel = tk.Label(frame, textvariable=self.updateVar) updateLabel.grid(row=1, column=0, sticky='nw', padx=5, pady=5) self._updateLabel()
def _createTopFrame(self, content): frame = tk.Frame(content) lfSamples = tk.LabelFrame(frame, text='Plot') gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) # Create tree for Population Variables tp = PopulationVariablesTreeProvider(self._variables.values()) self.tree = BoundTree(frame, tp, height=10) self.tree.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(frame) frame.grid(row=0, column=0, sticky='news', padx=5, pady=(10, 5))
def _fillTreeFrame(self, frame): self.tree = BoundTree(frame, self.provider) self.tree.grid(row=0, column=0) self.updateVar = tk.StringVar() updateLabel = tk.Label(frame, textvariable=self.updateVar) updateLabel.grid(row=1, column=0, sticky='nw', padx=5, pady=5) self._updateLabel()
def body(self, bodyFrame): bodyFrame.config() bodyFrame.columnconfigure(0, weight=1) bodyFrame.rowconfigure(0, weight=1) bodyFrame.columnconfigure(1, weight=1) # Create items frame itemsFrame = tk.Frame(bodyFrame, bg='white') itemsFrame.grid(row=0, column=0, padx=5, pady=5, sticky='news') itemsFrame.columnconfigure(0, weight=1) itemsFrame.rowconfigure(0, weight=1) itemsTree = BoundTree(itemsFrame, self.provider) itemsTree.grid(row=0, column=0, padx=5, pady=5, sticky='news') itemsTree.itemClick = self._itemSelected # Create preview frame previewFrame = tk.Frame(bodyFrame) previewFrame.grid(row=0, column=1, padx=5, pady=5) self._beforePreview() self._createPreview(previewFrame) # Create controls frame controlsFrame = tk.Frame(bodyFrame) controlsFrame.grid(row=1, column=1, padx=5, pady=5, sticky='news') self._createControls(controlsFrame) self._itemSelected(self.firstItem) itemsTree.selectChildByIndex(0) # Select the first item
def body(self, bodyFrame): bodyFrame.config() bodyFrame.columnconfigure(0, weight=1) bodyFrame.rowconfigure(0, weight=1) bodyFrame.columnconfigure(1, weight=1) # Create items frame itemsFrame = tk.Frame(bodyFrame, bg='white') itemsFrame.grid(row=0, column=0, padx=5, pady=5, sticky='news') itemsFrame.columnconfigure(0, weight=1) itemsFrame.rowconfigure(0, weight=1) itemsTree = BoundTree(itemsFrame, self.provider) itemsTree.grid(row=0, column=0, padx=5, pady=5, sticky='news') itemsTree.itemClick = self._itemSelected # Create preview frame previewFrame = tk.Frame(bodyFrame) previewFrame.grid(row=0, column=1, padx=5, pady=5) self._beforePreview() self._createPreview(previewFrame) # Create controls frame controlsFrame = tk.Frame(bodyFrame) controlsFrame.grid(row=1, column=1, padx=5, pady=5, sticky='news') self._createControls(controlsFrame) self._itemSelected(self.firstItem) itemsTree.selectChildByIndex(0) # Select the first item
def _createTopFrame(self, content): frame = tk.Frame(content) lfSamples = tk.LabelFrame(frame, text='Plot') gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) # Create tree for Population Variables tp = PopulationVariablesTreeProvider(self._variables.values()) self.tree = BoundTree(frame, tp, height=10) self.tree.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(frame) frame.grid(row=0, column=0, sticky='news', padx=5, pady=(10, 5))
def body(self, bodyFrame): bodyFrame.config() bodyFrame.columnconfigure(0, weight=1) bodyFrame.columnconfigure(1, weight=1) bodyFrame.columnconfigure(2, weight=1) # Create explanation label self.expText = ExplanationText(bodyFrame) self.expText.text.grid(row=0, column=0, columnspan=2, padx=5, pady=5, sticky='news') # Create items frame itemsFrame = tk.Frame(bodyFrame, bg=pw.TK_GRAY_DEFAULT) itemsFrame.grid(row=1, column=0, padx=5, sticky='news') itemsFrame.columnconfigure(0, weight=1) itemsFrame.rowconfigure(0, weight=1) itemsTree = BoundTree(itemsFrame, self.provider) itemsTree.grid(row=0, column=0, padx=5, pady=5, sticky='news') itemsTree.itemClick = self._itemSelected # Create preview frame previewFrame = tk.Frame(bodyFrame, bg=pw.TK_GRAY_DEFAULT) previewFrame.grid(row=1, column=1, padx=5, pady=5) self._beforePreview() self._createPreview(previewFrame) # Create controls frame controlsFrame = tk.Frame(bodyFrame) controlsFrame.grid(row=2, column=0, columnspan=2, padx=5, pady=5, sticky='sew') controlsFrame.columnconfigure(0, weight=1) controlsFrame.rowconfigure(2, weight=1) self._createControls(controlsFrame) self._itemSelected(self.firstItem) itemsTree.selectChildByIndex(0) # Select the first item
class PopulationWindow(gui.Window): """ """ def __init__(self, **kwargs): gui.Window.__init__(self, minsize=(620, 200), **kwargs) self.population = kwargs.get('population') self.callback = kwargs.get('callback', None) self.plotter = None self._variables = OrderedDict() self._variablesDict = {} self._loadVariables(self.population) content = tk.Frame(self.root) self._createContent(content) content.grid(row=0, column=0, sticky='news') gui.configureWeigths(content) def _loadVariables(self, population): self.observations = population.getAllParameters() mu, sigma, self.R, percentiles = population.getStats(self.observations) for i, varName in enumerate(population.modelParameters): v = PopulationVar(index=i, varName=varName, unitStr=PKPDUnit.codeToString( population.modelParameterUnits[i]), mu=mu[i], sigma=sigma[i], percentiles=[p[i] for p in percentiles]) self._variables[varName] = v def _createContent(self, content): # Create top frame with the variables list self._createTopFrame(content) # Create button frame with Plot button self._createButtonsFrame(content) # Create an info frame self._createBottomFrame(content) def _createTopFrame(self, content): frame = tk.Frame(content) lfSamples = tk.LabelFrame(frame, text='Plot') gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) # Create tree for Population Variables tp = PopulationVariablesTreeProvider(self._variables.values()) self.tree = BoundTree(frame, tp, height=10) self.tree.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(frame) frame.grid(row=0, column=0, sticky='news', padx=5, pady=(10, 5)) def _createButtonsFrame(self, content): frame = tk.Frame(content) self.plotButton = HotButton( frame, ' Plot ', font=self.fontBold, command=self._onPlotClick, tooltip='Select one or two variables to plot ') self.plotButton.grid(row=0, column=0, sticky='se', padx=5) frame.grid(row=1, column=0, sticky='sew', padx=5, pady=5) gui.configureWeigths(frame) def _createBottomFrame(self, content): frame = tk.Frame(content) t = TaggedText(frame, height=10) t.grid(row=0, column=0, sticky='news', padx=5, pady=5) t.addLine("*Correlation Matrix*") t.addText(np.array2string(self.R)) frame.grid(row=2, column=0, sticky='sew', padx=5, pady=5) gui.configureWeigths(frame) 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()
class SummaryWindow(pwgui.Window): def __init__(self, **kwargs): pwgui.Window.__init__(self, **kwargs) self.protocol = kwargs.get('protocol') self.refresh = self.protocol.samplingInterval.get() self.provider = SummaryProvider(self.protocol) content = tk.Frame(self.root) self._createContent(content) content.grid(row=0, column=0, sticky='news') content.columnconfigure(0, weight=1) def _createContent(self, content): topFrame = tk.Frame(content) content.columnconfigure(0, weight=1) topFrame.grid(row=0, column=0, sticky='new', padx=5, pady=5) treeFrame = tk.Frame(content) content.rowconfigure(1, weight=1) treeFrame.grid(row=1, column=0, sticky='news', padx=5, pady=5) buttonsFrame = tk.Frame(content) buttonsFrame.grid(row=2, column=0, sticky='new', padx=5, pady=5) self._fillTreeFrame(treeFrame) # JMRT: We fill the top frame after the tree, to make sure # the provider has updated the Acquisition info self._fillTopFrame(topFrame) self._fillButtonsFrame(buttonsFrame) def _fillTopFrame(self, frame): p1 = tk.Label(frame, text='Project: ') p1.grid(row=0, column=0, sticky='nw', padx=5, pady=5) projName = self.protocol.getProject().getShortName() p2 = tk.Label(frame, text=projName, font=self.fontBold) p2.grid(row=0, column=1, sticky='nw', padx=5, pady=0) lf = tk.LabelFrame(frame, text='Acquisition') lf.grid(row=1, column=0, columnspan=2, sticky='new') lf.columnconfigure(0, weight=1) lf.columnconfigure(1, weight=1) self.r = 0 def add(t1, t2): tk.Label(lf, text=t1).grid(row=self.r, column=0, sticky='ne', padx=(10, 5), pady=(5, 0)) tk.Label(lf, text=t2, font=self.fontBold).grid(row=self.r, column=1, sticky='nw', padx=(5, 25), pady=0) self.r += 1 for k, v in self.provider.acquisition: add(k, v) def _fillTreeFrame(self, frame): self.tree = BoundTree(frame, self.provider) self.tree.grid(row=0, column=0) self.updateVar = tk.StringVar() updateLabel = tk.Label(frame, textvariable=self.updateVar) updateLabel.grid(row=1, column=0, sticky='nw', padx=5, pady=5) self._updateLabel() def _fillButtonsFrame(self, frame): subframe = tk.Frame(frame) subframe.grid(row=0, column=0, sticky='nw') frame.columnconfigure(1, weight=1) ctfBtn = Button(subframe, "CTF Monitor", command=self._monitorCTF) ctfBtn.grid(row=0, column=0, sticky='nw', padx=(0, 5)) if self.protocol.createCtfMonitor() is None: ctfBtn['state'] = 'disabled' movieGainBtn = Button(subframe, "Movie Gain Monitor", command=self._monitorMovieGain) movieGainBtn.grid(row=0, column=1, sticky='nw', padx=(0, 5)) if self.protocol.createMovieGainMonitor() is None: movieGainBtn['state'] = 'disabled' sysBtn = Button(subframe, "System Monitor", command=self._monitorSystem) sysBtn.grid(row=0, column=2, sticky='nw', padx=(0, 5)) if self.protocol.createSystemMonitor() is None: sysBtn['state'] = 'disabled' htmlBtn = HotButton(subframe, 'Open HTML Report', command=self._openHTML) htmlBtn.grid(row=0, column=3, sticky='nw', padx=(0, 5)) closeBtn = self.createCloseButton(frame) closeBtn.grid(row=0, column=1, sticky='ne') def _monitorCTF(self, e=None): CtfMonitorPlotter(self.protocol.createCtfMonitor()).show() def _monitorMovieGain(self, e=None): MovieGainMonitorPlotter(self.protocol.createMovieGainMonitor()).show() def _monitorSystem(self, e=None): nifName = self.protocol.nifsNameList[self.protocol.netInterfaces.get()] SystemMonitorPlotter(self.protocol.createSystemMonitor(), nifName).show() def _updateLabel(self): self.updateVar.set('Updated: %s' % pwutils.prettyTime(secs=True)) # Schedule a refresh in some seconds self.tree.after(self.refresh * 1000, self._updateData) def _updateData(self): self.provider.refreshObjects() self.tree.update() self._updateLabel() def _openHTML(self, e=None): reportHtml = self.protocol.createHtmlReport() reportPath = reportHtml.reportPath if pwutils.exists(reportPath): text._open_cmd(reportPath) else: self.showInfo( 'Your html file is not ready yet. Please try again in a minute.' )
def _addBoundTree(self, parent, provider, height): bt = BoundTree(parent, provider, height=height) bt.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(parent) return bt
def _addBoundTree(self, parent, provider, height): bt = BoundTree(parent, provider, height=height) bt.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(parent) return bt
def _addBoundTree(self, parent, ProviderClass, height, **kwargs): bt = BoundTree(parent, ProviderClass(self.experiment, **kwargs), height=height) bt.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(parent) return bt
class SummaryWindow(pwgui.Window): def __init__(self, **kwargs): pwgui.Window.__init__(self, **kwargs) self.protocol = kwargs.get('protocol') self.refresh = self.protocol.samplingInterval.get() self.provider = SummaryProvider(self.protocol) content = tk.Frame(self.root) self._createContent(content) content.grid(row=0, column=0, sticky='news') content.columnconfigure(0, weight=1) def _createContent(self, content): topFrame = tk.Frame(content) content.columnconfigure(0, weight=1) topFrame.grid(row=0, column=0, sticky='new', padx=5, pady=5) treeFrame = tk.Frame(content) content.rowconfigure(1, weight=1) treeFrame.grid(row=1, column=0, sticky='news', padx=5, pady=5) buttonsFrame = tk.Frame(content) buttonsFrame.grid(row=2, column=0, sticky='new', padx=5, pady=5) self._fillTreeFrame(treeFrame) # JMRT: We fill the top frame after the tree, to make sure # the provider has updated the Acquisition info self._fillTopFrame(topFrame) self._fillButtonsFrame(buttonsFrame) def _fillTopFrame(self, frame): p1 = tk.Label(frame, text='Project: ') p1.grid(row=0, column=0, sticky='nw', padx=5, pady=5) projName = self.protocol.getProject().getShortName() p2 = tk.Label(frame, text=projName, font=self.fontBold) p2.grid(row=0, column=1, sticky='nw', padx=5, pady=0) lf = tk.LabelFrame(frame, text='Acquisition') lf.grid(row=1, column=0, columnspan=2, sticky='new') lf.columnconfigure(0, weight=1) lf.columnconfigure(1, weight=1) self.r = 0 def add(t1, t2): tk.Label(lf, text=t1).grid(row=self.r, column=0, sticky='ne', padx=(10, 5), pady=(5, 0)) tk.Label(lf, text=t2, font=self.fontBold).grid(row=self.r, column=1, sticky='nw', padx=(5, 25), pady=0) self.r += 1 for k, v in self.provider.acquisition: add(k, v) def _fillTreeFrame(self, frame): self.tree = BoundTree(frame, self.provider) self.tree.grid(row=0, column=0) self.updateVar = tk.StringVar() updateLabel = tk.Label(frame, textvariable=self.updateVar) updateLabel.grid(row=1, column=0, sticky='nw', padx=5, pady=5) self._updateLabel() def _fillButtonsFrame(self, frame): subframe = tk.Frame(frame) subframe.grid(row=0, column=0, sticky='nw') frame.columnconfigure(1, weight=1) ctfBtn = Button(subframe, "CTF Monitor", command=self._monitorCTF) ctfBtn.grid(row=0, column=0, sticky='nw', padx=(0, 5)) if self.protocol.createCtfMonitor() is None: ctfBtn['state'] = 'disabled' movieGainBtn = Button(subframe, "Movie Gain Monitor", command=self._monitorMovieGain) movieGainBtn.grid(row=0, column=1, sticky='nw', padx=(0, 5)) if self.protocol.createMovieGainMonitor() is None: movieGainBtn['state'] = 'disabled' sysBtn = Button(subframe, "System Monitor", command=self._monitorSystem) sysBtn.grid(row=0, column=2, sticky='nw', padx=(0, 5)) if self.protocol.createSystemMonitor() is None: sysBtn['state'] = 'disabled' htmlBtn = HotButton(subframe, 'Open HTML Report', command=self._openHTML) htmlBtn.grid(row=0, column=3, sticky='nw', padx=(0, 5)) closeBtn = self.createCloseButton(frame) closeBtn.grid(row=0, column=1, sticky='ne') def _monitorCTF(self, e=None): CtfMonitorPlotter(self.protocol.createCtfMonitor()).show() def _monitorMovieGain(self, e=None): MovieGainMonitorPlotter(self.protocol.createMovieGainMonitor()).show() def _monitorSystem(self, e=None): nifName = self.protocol.nifsNameList[self.protocol.netInterfaces.get()] SystemMonitorPlotter(self.protocol.createSystemMonitor(), nifName).show() def _updateLabel(self): self.updateVar.set('Updated: %s' % pwutils.prettyTime(secs=True)) # Schedule a refresh in some seconds self.tree.after(self.refresh * 1000, self._updateData) def _updateData(self): self.provider.refreshObjects() self.tree.update() self._updateLabel() def _openHTML(self, e=None): reportHtml = self.protocol.createHtmlReport() reportPath = reportHtml.reportPath if pwutils.exists(reportPath): text._open_cmd(reportPath) else: self.showInfo('Your html file is not ready yet. Please try again in a minute.')
class SummaryWindow(pwgui.Window): def __init__(self, **kwargs): pwgui.Window.__init__(self, **kwargs) self.protocol = kwargs.get('protocol') self.refresh = self.protocol.samplingInterval.get() self.provider = SummaryProvider(self.protocol) content = tk.Frame(self.root) self._createContent(content) content.grid(row=0, column=0, sticky='news') content.columnconfigure(0, weight=1) def _createContent(self, content): topFrame = tk.Frame(content) content.columnconfigure(0, weight=1) topFrame.grid(row=0, column=0, sticky='new', padx=5, pady=5) treeFrame = tk.Frame(content) content.rowconfigure(1, weight=1) treeFrame.grid(row=1, column=0, sticky='news', padx=5, pady=5) buttonsFrame = tk.Frame(content) buttonsFrame.grid(row=2, column=0, sticky='new', padx=5, pady=5) self._fillTreeFrame(treeFrame) # JMRT: We fill the top frame after the tree, to make sure # the provider has updated the Acquisition info self._fillTopFrame(topFrame) self._fillButtonsFrame(buttonsFrame) def _fillTopFrame(self, frame): p1 = tk.Label(frame, text='Project: ') p1.grid(row=0, column=0, sticky='nw', padx=5, pady=5) projName = self.protocol.getProject().getShortName() p2 = tk.Label(frame, text=projName, font=self.fontBold) p2.grid(row=0, column=1, sticky='nw', padx=5, pady=0) lf = tk.LabelFrame(frame, text='Acquisition') lf.grid(row=1, column=0, columnspan=2, sticky='new') lf.columnconfigure(0, weight=1) lf.columnconfigure(1, weight=1) self.r = 0 def add(t1, t2): tk.Label(lf, text=t1).grid(row=self.r, column=0, sticky='ne', padx=(10, 5), pady=(5, 0)) tk.Label(lf, text=t2, font=self.fontBold).grid(row=self.r, column=1, sticky='nw', padx=(5, 25), pady=0) self.r += 1 for k, v in self.provider.acquisition: add(k, v) def _fillTreeFrame(self, frame): self.tree = BoundTree(frame, self.provider) self.tree.grid(row=0, column=0) self.updateVar = tk.StringVar() updateLabel = tk.Label(frame, textvariable=self.updateVar) updateLabel.grid(row=1, column=0, sticky='nw', padx=5, pady=5) self._updateLabel() def _fillButtonsFrame(self, frame): subframe = tk.Frame(frame) subframe.grid(row=0, column=0, sticky='nw') frame.columnconfigure(1, weight=1) ctfBtn = Button(subframe, "CTF Monitor", command=self._monitorCTF) ctfBtn.grid(row=0, column=0, sticky='nw', padx=(0, 5)) sysBtn = Button(subframe, "System Monitor", command=self._monitorSystem) sysBtn.grid(row=0, column=1, sticky='nw', padx=(0, 5)) htmlBtn = HotButton(subframe, 'Generate HTML Report', command=self._generateHTML) htmlBtn.grid(row=0, column=2, sticky='nw', padx=(0, 5)) closeBtn = self.createCloseButton(frame) closeBtn.grid(row=0, column=1, sticky='ne') def _monitorCTF(self, e=None): from pyworkflow.em.protocol.monitors import CtfMonitorPlotter CtfMonitorPlotter(self.protocol.createCtfMonitor()).show() def _monitorSystem(self, e=None): from pyworkflow.em.protocol.monitors import SystemMonitorPlotter SystemMonitorPlotter(self.protocol.createSystemMonitor()).show() def _updateLabel(self): self.updateVar.set('Updated: %s' % pwutils.prettyTime(secs=True)) # Schedule a refresh in some seconds self.tree.after(self.refresh * 1000, self._updateData) def _updateData(self): self.provider.refreshObjects() self.tree.update() self._updateLabel() def _generateHTML(self, e=None): reportHtml = self.protocol.createHtmlReport() reportPath = reportHtml.generate(self.protocol.isFinished()) text._open_cmd(reportPath)
class PopulationWindow(gui.Window): """ """ def __init__(self, **kwargs): gui.Window.__init__(self, minsize=(620, 200), **kwargs) self.population = kwargs.get('population') self.callback = kwargs.get('callback', None) self.plotter = None self._variables = OrderedDict() self._variablesDict = {} self._loadVariables(self.population) content = tk.Frame(self.root) self._createContent(content) content.grid(row=0, column=0, sticky='news') gui.configureWeigths(content) def _loadVariables(self, population): self.observations = population.getAllParameters() mu, sigma, self.R, percentiles = population.getStats(self.observations) for i, varName in enumerate(population.modelParameters): v = PopulationVar(index=i, varName=varName, unitStr=PKPDUnit.codeToString(population.modelParameterUnits[i]), mu=mu[i], sigma=sigma[i], percentiles=[p[i] for p in percentiles]) self._variables[varName] = v def _createContent(self, content): # Create top frame with the variables list self._createTopFrame(content) # Create button frame with Plot button self._createButtonsFrame(content) # Create an info frame self._createBottomFrame(content) def _createTopFrame(self, content): frame = tk.Frame(content) lfSamples = tk.LabelFrame(frame, text='Plot') gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) # Create tree for Population Variables tp = PopulationVariablesTreeProvider(self._variables.values()) self.tree = BoundTree(frame, tp, height=10) self.tree.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(frame) frame.grid(row=0, column=0, sticky='news', padx=5, pady=(10, 5)) def _createButtonsFrame(self, content): frame = tk.Frame(content) self.plotButton = HotButton(frame, ' Plot ', font=self.fontBold, command=self._onPlotClick, tooltip='Select one or two variables to plot ') self.plotButton.grid(row=0, column=0, sticky='se', padx=5) frame.grid(row=1, column=0, sticky='sew', padx=5, pady=5) gui.configureWeigths(frame) def _createBottomFrame(self, content): frame = tk.Frame(content) t = TaggedText(frame, height=10) t.grid(row=0, column=0, sticky='news', padx=5, pady=5) t.addLine("*Correlation Matrix*") t.addText(np.array2string(self.R)) frame.grid(row=2, column=0, sticky='sew', padx=5, pady=5) gui.configureWeigths(frame) 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()