def open_figure(self, fig, props): """ Begin commands for a particular figure. Parameters ---------- fig : matplotlib.Figure The Figure which will contain the ensuing axes and elements props : dictionary The dictionary of figure properties """ self.canvas = PlotCanvas()
def create_widgets(self): '''create widgets on main window''' self.label_ts_m = QLabel("Transmission spectrum of material", self) self.label_ts_m.move(10, 10) self.textbox_ts_m = PathTextBox(self) self.textbox_ts_m.setFixedWidth(400) self.textbox_ts_m.move(10, 30) self.label_bg_m = QLabel("Back ground spectrum of material", self) self.label_bg_m.move(10, 60) self.textbox_bg_m = PathTextBox(self) self.textbox_bg_m.setFixedWidth(400) self.textbox_bg_m.move(10, 80) self.label_ts_r = QLabel("Transmission spectrum of reference", self) self.label_ts_r.move(10, 110) self.textbox_ts_r = PathTextBox(self) self.textbox_ts_r.setFixedWidth(400) self.textbox_ts_r.move(10, 130) self.label_bg_r = QLabel("Back ground spectrum of reference", self) self.label_bg_r.move(10, 160) self.textbox_bg_r = PathTextBox(self) self.textbox_bg_r.setFixedWidth(400) self.textbox_bg_r.move(10, 180) self.pbutton_calc = QPushButton("calc", self) self.pbutton_calc.move(10, 210) self.pbutton_calc.clicked.connect(self.go_calc) self.plot_canvas = PlotCanvas(self, 3, 2.5) self.plot_canvas.move(420, 0) self.pbutton_save = QPushButton("save", self) self.pbutton_save.move(130, 210) self.pbutton_save.clicked.connect(self.save_fig)
# WARNING/TODO: put the different sets of uniforms and put them in attributes instead for n, v in self._U[0].iteritems(): self._program[n] = v self._program['tr_scale'] = self._parent.panzoom.scale[:2] self._program['u_dash_atlas'] = gloo.Texture2D(self._collec.da._data) width, height = self.width, self.height self._program['u_scale'] = width // 2, height // 2 self._program['u_proj'] = orthographic(-width // 2, width // 2, -height // 2, height // 2, -1, +1) self._program.draw('triangles', indices=self.index) if __name__ == '__main__': ax = PlotCanvas(size=(600, 600)) x = np.linspace(-1., 1., 1000) y = .25 * np.sin(15 * x) vertices1 = np.c_[x, y] vertices2 = np.c_[np.cos(3 * x) * .5, np.sin(3 * x) * .5] ax.line = LineAggVisual(paths=[vertices1, vertices2], style=[ dict(color=(1., 0., 0., 1.)), dict(color=(0., 1., 0., 1.)), ]) ax.show()