當前位置: 首頁>>代碼示例>>Python>>正文


Python backend_tkagg.NavigationToolbar2TkAgg方法代碼示例

本文整理匯總了Python中matplotlib.backends.backend_tkagg.NavigationToolbar2TkAgg方法的典型用法代碼示例。如果您正苦於以下問題:Python backend_tkagg.NavigationToolbar2TkAgg方法的具體用法?Python backend_tkagg.NavigationToolbar2TkAgg怎麽用?Python backend_tkagg.NavigationToolbar2TkAgg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.backends.backend_tkagg的用法示例。


在下文中一共展示了backend_tkagg.NavigationToolbar2TkAgg方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from matplotlib.backends import backend_tkagg [as 別名]
# 或者: from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg [as 別名]
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() 
開發者ID:jakevdp,項目名稱:sklearn_pydata2015,代碼行數:27,代碼來源:svm_gui.py

示例2: view_init

# 需要導入模塊: from matplotlib.backends import backend_tkagg [as 別名]
# 或者: from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg [as 別名]
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) 
開發者ID:aizquier,項目名稱:voyagerimb,代碼行數:23,代碼來源:voyagerimb.py

示例3: setup

# 需要導入模塊: from matplotlib.backends import backend_tkagg [as 別名]
# 或者: from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg [as 別名]
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 
開發者ID:ankitaggarwal011,項目名稱:PiScope,代碼行數:41,代碼來源:PiScope.py

示例4: draw_canvas

# 需要導入模塊: from matplotlib.backends import backend_tkagg [as 別名]
# 或者: from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg [as 別名]
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) 
開發者ID:NeuromorphicProcessorProject,項目名稱:snn_toolbox,代碼行數:33,代碼來源:gui.py


注:本文中的matplotlib.backends.backend_tkagg.NavigationToolbar2TkAgg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。