Python matplotlib.backends.backend_tkagg.FigureCanvasTkAgg() Examples
The following are 30
code examples of matplotlib.backends.backend_tkagg.FigureCanvasTkAgg().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.backends.backend_tkagg
, or try the search function
.
Example #1
Source File: svm_gui.py From sklearn_pydata2015 with BSD 3-Clause "New" or "Revised" License | 7 votes |
def __init__(self, root, controller): f = Figure() ax = f.add_subplot(111) ax.set_xticks([]) ax.set_yticks([]) ax.set_xlim((x_min, x_max)) ax.set_ylim((y_min, y_max)) canvas = FigureCanvasTkAgg(f, master=root) canvas.show() canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1) canvas.mpl_connect('key_press_event', self.onkeypress) canvas.mpl_connect('key_release_event', self.onkeyrelease) canvas.mpl_connect('button_press_event', self.onclick) toolbar = NavigationToolbar2TkAgg(canvas, root) toolbar.update() self.shift_down = False self.controllbar = ControllBar(root, controller) self.f = f self.ax = ax self.canvas = canvas self.controller = controller self.contours = [] self.c_labels = None self.plot_kernels()
Example #2
Source File: graph.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.parent = parent self.degree = 5 self.graphFigure = Figure(figsize=(4,2), dpi=100, facecolor="black") self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3)) self.subplot.tick_params(axis="y", colors="grey", direction="in") self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off") self.graphFigure.axes[0].get_xaxis().set_ticklabels([]) self.graphFigure.subplots_adjust(left=(30/100), bottom=(15/100), right=1, top=(1-15/100), wspace=0, hspace=0) self.canvas = FigureCanvasTkAgg(self.graphFigure, self) self.canvas.get_tk_widget().configure(bg="black") self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True) self.canvas.show()
Example #3
Source File: voyagerimb.py From voyagerimb with MIT License | 6 votes |
def view_init(self): self.frame = tk.LabelFrame(self.browser.workframe, text=" Image ") self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7) self.figure = plt.figure(figsize=(8, 12), dpi=70) self.ax1 = plt.subplot2grid((50,40), (0, 0), rowspan=40, colspan=40) self.ax2 = plt.subplot2grid((50,40), (42, 0), rowspan=8, colspan=40, sharex=self.ax1) plt.subplots_adjust(left=0.1, bottom=0.05, right=0.95, top=0.97, wspace=0.2, hspace=0.2) self.view_plot_image() self.canvas = FigureCanvasTkAgg(self.figure, self.frame) if self.mpltlib3: self.canvas.draw() toolbar = NavigationToolbar2Tk(self.canvas, self.frame).update() else: self.canvas.show() toolbar = NavigationToolbar2TkAgg(self.canvas, self.frame).update() self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True) self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, padx=2, pady=2, expand=True) self.frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=7, pady=7)
Example #4
Source File: keyboard_gui.py From synthesizer with GNU Lesser General Public License v3.0 | 6 votes |
def do_plot(self, osc): if not matplotlib: self.statusbar["text"] = "Cannot plot! To plot things, you need to have matplotlib installed!" return o = self.create_osc(None, None, osc.input_freq.get(), osc, all_oscillators=self.oscillators).blocks() blocks = list(itertools.islice(o, self.synth.samplerate//params.norm_osc_blocksize)) # integrating matplotlib in tikinter, see http://matplotlib.org/examples/user_interfaces/embedding_in_tk2.html fig = Figure(figsize=(8, 2), dpi=100) axis = fig.add_subplot(111) axis.plot(sum(blocks, [])) axis.set_title("Waveform") self.do_close_waveform() canvas = FigureCanvasTkAgg(fig, master=self.waveform_area) canvas.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH, expand=1) canvas.draw() close_waveform = tk.Button(self.waveform_area, text="Close waveform", command=self.do_close_waveform) close_waveform.pack(side=tk.RIGHT)
Example #5
Source File: playbackFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def makeGraph(self): self.graphFigure = Figure(figsize=(1,0.1), dpi=50, facecolor="black") self.subplot = self.graphFigure.add_subplot(1,1,1, facecolor=(0.3, 0.3, 0.3)) self.subplot.tick_params(axis="y", colors="grey", labelbottom="off", bottom="off") self.subplot.tick_params(axis="x", colors="grey", labelbottom="off", bottom="off") self.graphFigure.axes[0].get_xaxis().set_ticklabels([]) self.graphFigure.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0) self.graphCanvas = FigureCanvasTkAgg(self.graphFigure, self) self.graphCanvas.get_tk_widget().configure(bg="black") self.graphCanvas.get_tk_widget().grid(row="2", column="2", columnspan="3", sticky="news") yValues = self.mainWindow.characterDetector.playbackLogReader.logEntryFrequency self.highestValue = 0 for value in yValues: if value > self.highestValue: self.highestValue = value self.subplot.plot(yValues, "dodgerblue") self.timeLine, = self.subplot.plot([0, 0], [0, self.highestValue], "white") #self.graphFigure.axes[0].set_xlim(0, len(yValues)) self.subplot.margins(0.005,0.01) self.graphCanvas.show() self.mainWindow.makeDraggable(self.graphCanvas.get_tk_widget())
Example #6
Source File: futures_spot_spreads.py From tqsdk-python with Apache License 2.0 | 5 votes |
def draw_figure(canvas, figure): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #7
Source File: plot.py From evo_slam with GNU General Public License v3.0 | 5 votes |
def tabbed_tk_window(self): from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk import sys if sys.version_info[0] < 3: import Tkinter as tkinter import ttk else: import tkinter from tkinter import ttk self.root_window = tkinter.Tk() self.root_window.title(self.title) # quit if the window is deleted self.root_window.protocol("WM_DELETE_WINDOW", self.root_window.quit) nb = ttk.Notebook(self.root_window) nb.grid(row=1, column=0, sticky='NESW') for name, fig in self.figures.items(): fig.tight_layout() tab = ttk.Frame(nb) canvas = FigureCanvasTkAgg(self.figures[name], master=tab) canvas.draw() canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) toolbar = NavigationToolbar2Tk(canvas, tab) toolbar.update() canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) for axes in fig.get_axes(): if isinstance(axes, Axes3D): # must explicitly allow mouse dragging for 3D plots axes.mouse_init() nb.add(tab, text=name) nb.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) self.root_window.mainloop() self.root_window.destroy()
Example #8
Source File: record.py From TensorKart with MIT License | 5 votes |
def create_main_panel(self): # Panels top_half = tk.Frame(self.root) top_half.pack(side=tk.TOP, expand=True, padx=5, pady=5) message = tk.Label(self.root, text="(Note: UI updates are disabled while recording)") message.pack(side=tk.TOP, padx=5) bottom_half = tk.Frame(self.root) bottom_half.pack(side=tk.LEFT, padx=5, pady=10) # Images self.img_panel = tk.Label(top_half, image=ImageTk.PhotoImage("RGB", size=IMAGE_SIZE)) # Placeholder self.img_panel.pack(side = tk.LEFT, expand=False, padx=5) # Joystick self.init_plot() self.PlotCanvas = FigCanvas(figure=self.fig, master=top_half) self.PlotCanvas.get_tk_widget().pack(side=tk.RIGHT, expand=False, padx=5) # Recording textframe = tk.Frame(bottom_half, width=332, height=15, padx=5) textframe.pack(side=tk.LEFT) textframe.pack_propagate(0) self.outputDirStrVar = tk.StringVar() self.txt_outputDir = tk.Entry(textframe, textvariable=self.outputDirStrVar, width=100) self.txt_outputDir.pack(side=tk.LEFT) self.outputDirStrVar.set("samples/" + datetime.now().strftime('%Y-%m-%d_%H:%M:%S')) self.record_button = ttk.Button(bottom_half, text="Record", command=self.on_btn_record) self.record_button.pack(side = tk.LEFT, padx=5)
Example #9
Source File: treeExplore.py From AiLearning with GNU General Public License v3.0 | 5 votes |
def main(root): # 标题 Label(root, text="Plot Place Holder").grid(row=0, columnspan=3) # 输入栏1, 叶子的数量 Label(root, text="tolN").grid(row=1, column=0) global tolNentry tolNentry = Entry(root) tolNentry.grid(row=1, column=1) tolNentry.insert(0, '10') # 输入栏2, 误差量 Label(root, text="tolS").grid(row=2, column=0) global tolSentry tolSentry = Entry(root) tolSentry.grid(row=2, column=1) # 设置输出值 tolSentry.insert(0,'1.0') # 设置提交的按钮 Button(root, text="确定", command=drawNewTree).grid(row=1, column=2, rowspan=3) # 设置复选按钮 global chkBtnVar chkBtnVar = IntVar() chkBtn = Checkbutton(root, text="Model Tree", variable = chkBtnVar) chkBtn.grid(row=3, column=0, columnspan=2) # 退出按钮 Button(root, text="退出", fg="black", command=quit).grid(row=1, column=2) # 创建一个画板 canvas reDraw.f = Figure(figsize=(5, 4), dpi=100) reDraw.canvas = FigureCanvasTkAgg(reDraw.f, master=root) reDraw.canvas.show() reDraw.canvas.get_tk_widget().grid(row=0, columnspan=3) reDraw.rawDat = mat(regTrees.loadDataSet('data/9.RegTrees/sine.txt')) reDraw.testDat = arange(min(reDraw.rawDat[:, 0]), max(reDraw.rawDat[:, 0]), 0.01) reDraw(1.0, 10)
Example #10
Source File: PiScope.py From PiScope with MIT License | 5 votes |
def setup(self, channels): print "Setting up the channels..." self.channels = channels # Setup oscilloscope window self.root = Tkinter.Tk() self.root.wm_title("PiScope") if len(self.channels) == 1: # Create x and y axis xAchse = pylab.arange(0, 4000, 1) yAchse = pylab.array([0]*4000) # Create the plot fig = pylab.figure(1) self.ax = fig.add_subplot(111) self.ax.set_title("Oscilloscope") self.ax.set_xlabel("Time") self.ax.set_ylabel("Amplitude") self.ax.axis([0, 4000, 0, 3.5]) elif len(self.channels) == 2: # Create x and y axis xAchse = pylab.array([0]*4000) yAchse = pylab.array([0]*4000) # Create the plot fig = pylab.figure(1) self.ax = fig.add_subplot(111) self.ax.set_title("X-Y Plotter") self.ax.set_xlabel("Channel " + str(self.channels[0])) self.ax.set_ylabel("Channel " + str(self.channels[1])) self.ax.axis([0, 3.5, 0, 3.5]) self.ax.grid(True) self.line1 = self.ax.plot(xAchse, yAchse, '-') # Integrate plot on oscilloscope window self.drawing = FigureCanvasTkAgg(fig, master=self.root) self.drawing.show() self.drawing.get_tk_widget().pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1) # Setup navigation tools tool = NavigationToolbar2TkAgg(self.drawing, self.root) tool.update() self.drawing._tkcanvas.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=1) return
Example #11
Source File: treeExplore.py From AiLearning with GNU General Public License v3.0 | 5 votes |
def main(root): # 标题 Label(root, text="Plot Place Holder").grid(row=0, columnspan=3) # 输入栏1, 叶子的数量 Label(root, text="tolN").grid(row=1, column=0) global tolNentry tolNentry = Entry(root) tolNentry.grid(row=1, column=1) tolNentry.insert(0, '10') # 输入栏2, 误差量 Label(root, text="tolS").grid(row=2, column=0) global tolSentry tolSentry = Entry(root) tolSentry.grid(row=2, column=1) # 设置输出值 tolSentry.insert(0,'1.0') # 设置提交的按钮 Button(root, text="确定", command=drawNewTree).grid(row=1, column=2, rowspan=3) # 设置复选按钮 global chkBtnVar chkBtnVar = IntVar() chkBtn = Checkbutton(root, text="Model Tree", variable = chkBtnVar) chkBtn.grid(row=3, column=0, columnspan=2) # 退出按钮 Button(root, text="退出", fg="black", command=quit).grid(row=1, column=2) # 创建一个画板 canvas reDraw.f = Figure(figsize=(5, 4), dpi=100) reDraw.canvas = FigureCanvasTkAgg(reDraw.f, master=root) reDraw.canvas.show() reDraw.canvas.get_tk_widget().grid(row=0, columnspan=3) reDraw.rawDat = mat(regTrees.loadDataSet('data/9.RegTrees/sine.txt')) reDraw.testDat = arange(min(reDraw.rawDat[:, 0]), max(reDraw.rawDat[:, 0]), 0.01) reDraw(1.0, 10)
Example #12
Source File: yass_gui.py From yass with Apache License 2.0 | 5 votes |
def __init__(self, window): self.window = window # voltage window self.fig2 = Figure(figsize=(6,3)) self.a2 = self.fig2.add_subplot(111) self.a2.set_yticks([]) self.a2.set_xticks([]) self.a2.set_title("Voltage chunk example", fontsize=8) self.canvas2 = FigureCanvasTkAgg(self.fig2, self.window) self.canvas2.get_tk_widget().place(x = 225, y = 300)#, relwidth = , relheight = 1) self.canvas2.draw() # geometry window self.fig1 = Figure(figsize=(3.0,3)) self.a = self.fig1.add_subplot(111) self.a.set_ylabel("um", fontsize=8) self.a.set_yticks([]) self.a.set_xticks([]) self.a.set_xlabel("um", fontsize=8) self.a.set_title("Geometry", fontsize=8) self.a.xaxis.set_tick_params(labelsize=8) self.a.yaxis.set_tick_params(labelsize=8) self.canvas1 = FigureCanvasTkAgg(self.fig1, self.window) self.canvas1.get_tk_widget().place(x = 0, y = 300)#, relwidth = , relheight = 1) self.canvas1.draw()
Example #13
Source File: click_plotter.py From kcauto with GNU General Public License v3.0 | 5 votes |
def create_canvas(self, canvas): self.canvas = FigureCanvasTkAgg(self.fig, canvas)
Example #14
Source File: Code Counter.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def display_charts(char_cnt, window): """ create charts to display in window """ def draw_figure(canvas, figure, loc=(0, 0)): """ matplotlib helper function """ figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack() return figure_canvas_agg figure = plt.figure(num=1, figsize=(4, 5)) # histogram plt.subplot(211) plt.hist(char_cnt) plt.title('character count per line') plt.ylabel('frequency') plt.tight_layout() # line plot plt.subplot(212) x = range(0, len(char_cnt)) y = char_cnt plt.plot(y) plt.fill_between(x, y) plt.title('compressed code line counts') plt.xlabel('code line number') plt.ylabel('number of characters') plt.tight_layout() draw_figure(window['IMG'].TKCanvas, figure)
Example #15
Source File: Demo_Matplotlib_Browser_Paned.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #16
Source File: Demo_Pyplot_Bar_Chart.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure, loc=(0, 0)): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg # ------------------------------- Beginning of GUI CODE -------------------------------
Example #17
Source File: Demo_Matplotlib_Browser.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #18
Source File: Demo_Matplotlib_Animated_Scatter.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #19
Source File: Demo_Matplotlib_Embedded_Toolbar.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure_w_toolbar(canvas, fig, canvas_toolbar): if canvas.children: for child in canvas.winfo_children(): child.destroy() if canvas_toolbar.children: for child in canvas_toolbar.winfo_children(): child.destroy() figure_canvas_agg = FigureCanvasTkAgg(fig, master=canvas) figure_canvas_agg.draw() toolbar = Toolbar(figure_canvas_agg, canvas_toolbar) toolbar.update() figure_canvas_agg.get_tk_widget().pack(side='right', fill='both', expand=1)
Example #20
Source File: Demo_Pyplot_Bar_Chart2.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure, loc=(0, 0)): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg # ------------------------------- Beginning of GUI CODE -------------------------------
Example #21
Source File: Demo_Matplotlib_Animated.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure, loc=(0, 0)): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #22
Source File: Demo_Matplotlib_Browser_Paned.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #23
Source File: Demo_Matplotlib_Browser.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #24
Source File: Demo_Matplotlib_Animated_Scatter.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #25
Source File: Demo_Matplotlib_Animated.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure, loc=(0, 0)): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg
Example #26
Source File: Demo_Matplotlib.py From PySimpleGUI with GNU Lesser General Public License v3.0 | 5 votes |
def draw_figure(canvas, figure, loc=(0, 0)): figure_canvas_agg = FigureCanvasTkAgg(figure, canvas) figure_canvas_agg.draw() figure_canvas_agg.get_tk_widget().pack(side='top', fill='both', expand=1) return figure_canvas_agg #------------------------------- Beginning of GUI CODE ------------------------------- # define the window layout
Example #27
Source File: plot.py From evo with GNU General Public License v3.0 | 5 votes |
def tabbed_tk_window(self): from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk import sys if sys.version_info[0] < 3: import Tkinter as tkinter import ttk else: import tkinter from tkinter import ttk self.root_window = tkinter.Tk() self.root_window.title(self.title) # quit if the window is deleted self.root_window.protocol("WM_DELETE_WINDOW", self.root_window.quit) nb = ttk.Notebook(self.root_window) nb.grid(row=1, column=0, sticky='NESW') for name, fig in self.figures.items(): fig.tight_layout() tab = ttk.Frame(nb) canvas = FigureCanvasTkAgg(self.figures[name], master=tab) canvas.draw() canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) toolbar = NavigationToolbar2Tk(canvas, tab) toolbar.update() canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) for axes in fig.get_axes(): if isinstance(axes, Axes3D): # must explicitly allow mouse dragging for 3D plots axes.mouse_init() nb.add(tab, text=name) nb.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) self.root_window.mainloop() self.root_window.destroy()
Example #28
Source File: gui.py From snn_toolbox with MIT License | 5 votes |
def draw_canvas(self): """Draw canvas figure.""" # Create figure with subplots, a canvas to hold them, and add # matplotlib navigation toolbar. if self.layer_to_plot.get() is '': return if hasattr(self, 'plot_container') \ and not self.settings['open_new'].get() \ and not self.is_plot_container_destroyed: self.plot_container.wm_withdraw() self.plot_container = tk.Toplevel(bg='white') self.plot_container.geometry('1920x1080') self.is_plot_container_destroyed = False self.plot_container.wm_title('Results from simulation run {}'.format( self.selected_plots_dir.get())) self.plot_container.protocol('WM_DELETE_WINDOW', self.close_window) tk.Button(self.plot_container, text='Close Window', command=self.close_window).pack() f = plt.figure(figsize=(30, 15)) f.subplots_adjust(left=0.01, bottom=0.05, right=0.99, top=0.99, wspace=0.01, hspace=0.01) num_rows = 3 num_cols = 5 gs = gridspec.GridSpec(num_rows, num_cols) self.a = [plt.subplot(gs[i, 0:-2]) for i in range(3)] self.a += [plt.subplot(gs[i, -2]) for i in range(3)] self.a += [plt.subplot(gs[i, -1]) for i in range(3)] self.canvas = FigureCanvasTkAgg(f, self.plot_container) graph_widget = self.canvas.get_tk_widget() graph_widget.pack(side='top', fill='both', expand=True) self.toolbar = NavigationToolbar2TkAgg(self.canvas, graph_widget)
Example #29
Source File: status.py From copycat with MIT License | 5 votes |
def __init__(self, parent, status, title): ttk.Frame.__init__(self, parent) self.status = status self.canvas = FigureCanvasTkAgg(status.figure, self) self.canvas.show() self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True) self.animation = animation.FuncAnimation(status.figure, lambda i : status.update_plots(i), interval=1000)
Example #30
Source File: gui.py From stochopy with MIT License | 5 votes |
def frame2(self): from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg self.frame2 = ttk.Frame(self.master, borderwidth = 2, relief = "groove") self.frame2.place(bordermode = "outside", relwidth = 0.99, relheight = 0.72, relx = 0, rely = 0.22, x = 5, y = 5, anchor = "nw") self.frame2.canvas = ttk.Frame(self.frame2, borderwidth = 0) self.frame2.canvas.place(relwidth = 1, relheight = 1, relx = 0, anchor = "nw") self.fig = Figure(figsize = (13, 6), facecolor = "white") self.canvas = FigureCanvasTkAgg(self.fig, master = self.frame2.canvas) self.fig.canvas.mpl_connect("button_press_event", self._onClick) self.canvas.get_tk_widget().pack()