def add(self, E, selected=None, overlay=False): """Add ekin proj to plot""" total = len(E.datasets) if total == 0: return if selected == None: datasets = E.datasets else: datasets = self.getNames(selected, E) if len(datasets) > 25: print 'too many plots' datasets = datasets[:25] elif len(E.datasets) == 1: datasets = E.datasets[0] if len(datasets) == 0: datasets = E.datasets if overlay == True: plotopt = 3 self.Opt.opts['legend'] = True else: plotopt = 2 fr = Frame(self.pw) self.pw.add(fr) plotframe = PlotPanel(parent=fr, side=BOTTOM, tools=True) plotframe.setProject(E) plotframe.Opts.opts = self.Opt.opts plotframe.Opts.opts['title'] = E.name plotframe.Opts.opts['normalise'] = overlay plotframe.plotCurrent(datasets=datasets, plotoption=plotopt) self.plotframes[E.name] = plotframe return plotframe
def showPreview(self, event=None): if self.E == None: return if not hasattr(self, 'plotframe') or self.plotframe == None: from Ekin.Plotting import PlotPanel self.plotframe = PlotPanel(parent=self.mainwin, side=BOTTOM) self.plotframe.setProject(self.E) d = self.dmenu.getcurselection() self.plotframe.plotCurrent(d) #plt.close(1) return