def configure_subplots(self, button): toolfig = Figure(figsize=(6, 3)) canvas = self._get_canvas(toolfig) toolfig.subplots_adjust(top=0.9) tool = SubplotTool(self.canvas.figure, toolfig) w = int(toolfig.bbox.width) h = int(toolfig.bbox.height) window = Gtk.Window() try: window.set_icon_from_file(window_icon) except Exception: # we presumably already logged a message on the # failure of the main plot, don't keep reporting pass window.set_title("Subplot Configuration Tool") window.set_default_size(w, h) vbox = Gtk.Box() vbox.set_property("orientation", Gtk.Orientation.VERTICAL) window.add(vbox) vbox.show() canvas.show() vbox.pack_start(canvas, True, True, 0) window.show()
def init_window(self): if self.window: return self.window = Gtk.Window(title="Subplot Configuration Tool") try: self.window.window.set_icon_from_file(window_icon) except Exception: # we presumably already logged a message on the # failure of the main plot, don't keep reporting pass self.vbox = Gtk.Box() self.vbox.set_property("orientation", Gtk.Orientation.VERTICAL) self.window.add(self.vbox) self.vbox.show() self.window.connect('destroy', self.destroy) toolfig = Figure(figsize=(6, 3)) canvas = self.figure.canvas.__class__(toolfig) toolfig.subplots_adjust(top=0.9) SubplotTool(self.figure, toolfig) w = int(toolfig.bbox.width) h = int(toolfig.bbox.height) self.window.set_default_size(w, h) canvas.show() self.vbox.pack_start(canvas, True, True, 0) self.window.show()
def prepare_configure_subplots(self): toolfig = Figure(figsize=(6, 3)) canvas = FigureCanvasMac(toolfig) toolfig.subplots_adjust(top=0.9) # Need to keep a reference to the tool. _tool = SubplotTool(self.canvas.figure, toolfig) return canvas
def configure_subplots(self): toolfig = Figure(figsize=(6, 3)) window = Tk.Tk() canvas = FigureCanvasTkAgg(toolfig, master=window) toolfig.subplots_adjust(top=0.9) tool = SubplotTool(self.canvas.figure, toolfig) canvas.show() canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
def configure_subplots(self): toolfig = Figure(figsize=(6, 3)) window = Tk.Toplevel() canvas = type(self.canvas)(toolfig, master=window) toolfig.subplots_adjust(top=0.9) canvas.tool = SubplotTool(self.canvas.figure, toolfig) canvas.draw() canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) window.grab_set()
def configure_subplots(self, *args): window = Fltk.Fl_Double_Window(100, 100, 480, 240) toolfig = Figure(figsize=(6, 3)) canvas = FigureCanvasFltkAgg(toolfig) window.end() toolfig.subplots_adjust(top=0.9) tool = SubplotTool(self.canvas.figure, toolfig) window.show() canvas.show()
def init_window(self): if self.window: return toolfig = Figure(figsize=(6, 3)) self.window = Tk.Tk() canvas = FigureCanvasTkAgg(toolfig, master=self.window) toolfig.subplots_adjust(top=0.9) _tool = SubplotTool(self.figure, toolfig) canvas.show() canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) self.window.protocol("WM_DELETE_WINDOW", self.destroy)
def init_window(self): if self.window: return toolfig = Figure(figsize=(6, 3)) self.window = tk.Tk() canvas = type(self.canvas)(toolfig, main=self.window) toolfig.subplots_adjust(top=0.9) SubplotTool(self.figure, toolfig) canvas.draw() canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1) self.window.protocol("WM_DELETE_WINDOW", self.destroy)
def configure_subplots(self, button): toolfig = Figure(figsize=(6, 3)) canvas = self._get_canvas(toolfig) toolfig.subplots_adjust(top=0.9) tool = SubplotTool(self.canvas.figure, toolfig) w = int(toolfig.bbox.width()) h = int(toolfig.bbox.height()) window = gtk.Window() window.set_title("Subplot Configuration Tool") window.set_default_size(w, h) vbox = gtk.VBox() window.add(vbox) vbox.show() canvas.show() vbox.pack_start(canvas, True, True) window.show()
def configure_subplots(self): self.adj_window = QtGui.QDialog() win = self.adj_window win.setAttribute(QtCore.Qt.WA_DeleteOnClose) win.setWindowTitle("Subplot Configuration Tool") image = os.path.join( matplotlib.rcParams['datapath'],'matplotlib.png' ) win.setWindowIcon(QtGui.QIcon( image )) toolfig = Figure(figsize=(6,3)) toolfig.subplots_adjust(top=0.9) canvas = self._get_canvas(toolfig) tool = SubplotTool(self.canvas.figure, toolfig) canvas.setParent(win) w = int (toolfig.bbox.width()) h = int (toolfig.bbox.height()) win.resize(w, h) canvas.setFocus() win.show()
def configure_subplots(self): self.adj_window = qt.QMainWindow(None, None, qt.Qt.WDestructiveClose) win = self.adj_window win.setCaption("Subplot Configuration Tool") toolfig = Figure(figsize=(6, 3)) toolfig.subplots_adjust(top=0.9) w = int(toolfig.bbox.width) h = int(toolfig.bbox.height) canvas = self._get_canvas(toolfig) tool = SubplotTool(self.canvas.figure, toolfig) centralWidget = qt.QWidget(win) canvas.reparent(centralWidget, qt.QPoint(0, 0)) win.setCentralWidget(centralWidget) layout = qt.QVBoxLayout(centralWidget) layout.addWidget(canvas, 1) win.resize(w, h) canvas.setFocus() win.show()
def configure_subplots(self, *args): # Fixed MPL subplot window generator from matplotlib.backends.backend_wx import _set_frame_icon, FigureManagerWx from matplotlib.widgets import SubplotTool frame = wx.Frame(None, -1, "Configure subplots") _set_frame_icon(frame) toolfig = Figure((6, 3)) canvas = FigureCanvasWxAgg(frame, -1, toolfig) # Create a figure manager to manage things FigureManagerWx(canvas, 1, frame) # Now put all into a sizer sizer = wx.BoxSizer(wx.VERTICAL) # This way of adding to sizer allows resizing sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW) frame.SetSizer(sizer) frame.Fit() SubplotTool(self.fig.canvas.figure, toolfig) frame.Show()
def configure_subplots(self, button): toolfig = self._init_toolfig("Subplot Configuration Tool", (6, 3)) toolfig.subplots_adjust(top=0.9) # Need to keep a reference to the tool. _tool = SubplotTool(self.canvas.figure, toolfig)