当前位置: 首页>>代码示例>>Python>>正文


Python backend_gtk3cairo.FigureCanvasGTK3Cairo类代码示例

本文整理汇总了Python中matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasGTK3Cairo类的具体用法?Python FigureCanvasGTK3Cairo怎么用?Python FigureCanvasGTK3Cairo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FigureCanvasGTK3Cairo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw

	def draw(self):
		x = [5,8,10]
		y = [12,16,6]
		
		x2 = [6,9,11]
		y2 = [6,15,7]
		
		fig, ax = plt.subplots()		
		canvas = FigureCanvas(fig)
		canvas.set_size_request(600,600)
		canvas.set_parent(self._scrolledwindow)
		#self._scrolledwindow.add_with_viewport(canvas)
	
		ax.bar(x, y, align='center')
		
		ax.bar(x2, y2, color='y', align='center')
		
		ax.plot()
		
		plt.title('Epic Info')
		plt.ylabel('Y axis')
		plt.xlabel('X axis')

		#print(dir(fig.canvas))
		#plt.draw()
		plt.show(block=False)
开发者ID:neo5g,项目名称:gsrp5,代码行数:26,代码来源:views.py

示例2: __init__

    def __init__(self, application):
        """ Create a summary page containing various statistics such as the number of logs in the logbook, the logbook's modification date, etc.

        :arg application: The PyQSO application containing the main Gtk window, etc.
        """

        self.application = application
        self.logbook = self.application.logbook
        self.builder = self.application.builder
        glade_file_path = join(realpath(dirname(__file__)), "res", "pyqso.glade")
        self.builder.add_objects_from_file(glade_file_path, ("summary_page",))
        self.summary_page = self.builder.get_object("summary_page")

        self.items = {}

        # Database name in large font at the top of the summary page
        self.builder.get_object("database_name").set_markup("<span size=\"x-large\">%s</span>" % basename(self.logbook.path))
        self.items["LOG_COUNT"] = self.builder.get_object("log_count")
        self.items["QSO_COUNT"] = self.builder.get_object("qso_count")
        self.items["DATE_MODIFIED"] = self.builder.get_object("date_modified")

        # Yearly statistics
        config = configparser.ConfigParser()
        have_config = (config.read(expanduser('~/.config/pyqso/preferences.ini')) != [])
        (section, option) = ("general", "show_yearly_statistics")
        if(have_config and config.has_option(section, option)):
            if(config.getboolean("general", "show_yearly_statistics") and have_matplotlib):
                hbox = Gtk.HBox()
                label = Gtk.Label(label="Display statistics for year: ", halign=Gtk.Align.START)
                hbox.pack_start(label, False, False, 6)
                year_select = Gtk.ComboBoxText()
                min_year, max_year = self.get_year_bounds()
                if min_year and max_year:
                    for year in range(max_year, min_year-1, -1):
                        year_select.append_text(str(year))
                year_select.append_text("")
                year_select.connect("changed", self.on_year_changed)
                hbox.pack_start(year_select, False, False, 6)
                self.summary_page.pack_start(hbox, False, False, 4)

                self.items["YEARLY_STATISTICS"] = Figure()
                canvas = FigureCanvas(self.items["YEARLY_STATISTICS"])
                canvas.set_size_request(800, 175)
                canvas.show()
                self.summary_page.pack_start(canvas, True, True, 0)

        # Summary tab label and icon.
        tab = Gtk.HBox(homogeneous=False, spacing=0)
        label = Gtk.Label(label="Summary  ")
        icon = Gtk.Image.new_from_icon_name(Gtk.STOCK_INDEX, Gtk.IconSize.MENU)
        tab.pack_start(label, False, False, 0)
        tab.pack_start(icon, False, False, 0)
        tab.show_all()

        self.logbook.notebook.insert_page(self.summary_page, tab, 0)  # Append as a new tab
        self.logbook.notebook.show_all()

        return
开发者ID:ctjacobs,项目名称:pyqso,代码行数:58,代码来源:summary.py

示例3: open_detatiled_station_window

	def open_detatiled_station_window(self, station_name, x=0, y=0):
		latest_data = []
		station_url = ""

		#Find the correct link for the requested station
		for link in self.every_station_link:
			if link[0] == station_name:
				#Perform detailed scrape
				latest_data = detailed_station_scrape(link[1], station_name)
				station_url = link[1]

		csv_url = get_csv_link(station_url, station_name)
		
		# Build new window based on Glade file.
		builder = Gtk.Builder()
		builder.add_from_file("Station Window.glade")
		builder.connect_signals(Handler())

		builder.get_object("label1").set_text(station_name)
		builder.get_object("label7").set_text(latest_data[0])
		builder.get_object("label8").set_text(latest_data[1])
		builder.get_object("label9").set_text(latest_data[2])
		builder.get_object("label10").set_text(latest_data[3])
		builder.get_object("label11").set_text(latest_data[4])
		builder.get_object("label18").set_text(latest_data[5])
		builder.get_object("label19").set_text(latest_data[6])
		builder.get_object("label20").set_text(latest_data[7])
		builder.get_object("label21").set_text(latest_data[8])
		builder.get_object("label22").set_text(latest_data[9])
		builder.get_object("label26").set_text(latest_data[10])
		builder.get_object("label27").set_text(latest_data[11])
		builder.get_object("label28").set_text(latest_data[12])

		display_station_win = builder.get_object("window1")
		display_station_win.set_title(station_name)
		display_station_win.move(x,y)

		refresh_butt = builder.get_object("button1")
		refresh_butt.connect("clicked", self.on_refresh_clicked)

		display_station_win.connect("delete-event", self.close_window_and_remove_reference)
		self.list_of_current_windows.append(display_station_win)#Dogfood # Stores current window in array so they can be iterated through when saving

		# Graph
		if csv_url != "no data":
			temperature_data = csv_scrap(csv_url)
			fig = temperature_graph(temperature_data)
			scroll_win = builder.get_object("scrolledwindow1")
			canvas = FigureCanvas(fig)
			canvas.set_size_request(400,400)
			scroll_win.add_with_viewport(canvas)

		display_station_win.show_all()
开发者ID:paulbutera,项目名称:SEPT-BogVirus,代码行数:53,代码来源:scrapeWeather.py

示例4: PlotWidget

class PlotWidget(Widgets.WidgetBase):

    def __init__(self, plot, width=500, height=500):
        super(PlotWidget, self).__init__()

        self.widget = FigureCanvas(plot.get_figure())
        self.plot = plot

        self.widget.set_size_request(width, height)
        self.widget.show_all()

    def configure_window(self, wd, ht):
        self.logger.debug("canvas resized to %dx%d" % (wd, ht))
        fig = self.plot.get_figure()
        fig.set_size_inches(float(wd) / fig.dpi, float(ht) / fig.dpi)
开发者ID:naojsoft,项目名称:ginga,代码行数:15,代码来源:Plot.py

示例5: __init__

    def __init__(self, workdir, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.workdir = workdir

        # main containers
        scr_win = Gtk.ScrolledWindow(visible=True)
        pad_box = Gtk.Box(visible=True)
        pad_box.pack_start(scr_win, True, True, 20)

        main_box = Gtk.Box(visible=True, orientation=Gtk.Orientation.VERTICAL)
        scr_win.add_with_viewport(main_box)

        # content
        lbl_head = '<span font="36.0"><b>Project Stats</b></span>'
        heading = Gtk.Label(label=lbl_head, expand=True, visible=True)
        heading.set_use_markup(True)
        main_box.pack_start(heading, False, False, 0)
        line = Gtk.Separator(visible=True)
        main_box.pack_start(line, False, False, 0)

        self.fig = Figure(facecolor='none')
        self.ax = self.fig.add_subplot(111, axisbg='#ffffff')
        self.canvas = FigCanvas(self.fig)
        self.canvas.set_size_request(800, 600)
        self.canvas.draw()
        self.canvas.show()
        main_box.pack_start(self.canvas, True, True, 0)

        self.add(pad_box)
        self.titlebar = Ide.WorkbenchHeaderBar(visible=True)

         # Gather stats
        thread = threading.Thread(target=self.gather_stats)
        thread.daemon = True
        thread.start()
开发者ID:tobias47n9e,项目名称:builder-project-stats,代码行数:35,代码来源:__init__.py

示例6: __init__

	def __init__(self, application, size_request=None):
		"""
		:param tuple size_request: The size to set for the canvas.
		"""
		self.application = application
		self.config = application.config
		"""A reference to the King Phisher client configuration."""
		self.figure, _ = pyplot.subplots()
		self.axes = self.figure.get_axes()
		self.canvas = FigureCanvas(self.figure)
		self.manager = None
		if size_request:
			self.canvas.set_size_request(*size_request)
		self.canvas.mpl_connect('button_press_event', self.mpl_signal_canvas_button_pressed)
		self.canvas.show()
		self.navigation_toolbar = NavigationToolbar(self.canvas, self.application.get_active_window())
		self.popup_menu = Gtk.Menu.new()

		menu_item = Gtk.MenuItem.new_with_label('Export')
		menu_item.connect('activate', self.signal_activate_popup_menu_export)
		self.popup_menu.append(menu_item)

		menu_item = Gtk.MenuItem.new_with_label('Refresh')
		menu_item.connect('activate', lambda action: self.refresh())
		self.popup_menu.append(menu_item)

		menu_item = Gtk.CheckMenuItem.new_with_label('Show Toolbar')
		menu_item.connect('toggled', self.signal_toggled_popup_menu_show_toolbar)
		self._menu_item_show_toolbar = menu_item
		self.popup_menu.append(menu_item)
		self.popup_menu.show_all()
		self.navigation_toolbar.hide()
开发者ID:coldfusion39,项目名称:king-phisher,代码行数:32,代码来源:graphs.py

示例7: __init__

	def __init__(self, application, size_request=None, style_context=None):
		"""
		:param tuple size_request: The size to set for the canvas.
		"""
		self.application = application
		self.style_context = style_context
		self.config = application.config
		"""A reference to the King Phisher client configuration."""
		self.figure, _ = pyplot.subplots()
		self.figure.set_facecolor(self.get_color('bg', ColorHexCode.WHITE))
		self.axes = self.figure.get_axes()
		self.canvas = FigureCanvas(self.figure)
		self.manager = None
		self.minimum_size = (380, 200)
		"""An absolute minimum size for the canvas."""
		if size_request is not None:
			self.resize(*size_request)
		self.canvas.mpl_connect('button_press_event', self.mpl_signal_canvas_button_pressed)
		self.canvas.show()
		self.navigation_toolbar = NavigationToolbar(self.canvas, self.application.get_active_window())

		self.popup_menu = managers.MenuManager()
		self.popup_menu.append('Export', self.signal_activate_popup_menu_export)
		self.popup_menu.append('Refresh', self.signal_activate_popup_refresh)

		menu_item = Gtk.CheckMenuItem.new_with_label('Show Toolbar')
		menu_item.connect('toggled', self.signal_toggled_popup_menu_show_toolbar)
		self._menu_item_show_toolbar = menu_item
		self.popup_menu.append_item(menu_item)

		self.navigation_toolbar.hide()
		self._legend = None
开发者ID:fo0nikens,项目名称:king-phisher,代码行数:32,代码来源:graphs.py

示例8: create_ui

    def create_ui(self):
        self.fig = Figure(figsize=(8, 8), dpi=100)
        self.axes = []

        sw = Gtk.ScrolledWindow()

        plot_box = Gtk.VBox()
        sw.add_with_viewport(plot_box)

        canvas = FigureCanvas(self.fig)
        canvas.set_size_request(500, 600)
        plot_box.pack_start(canvas, True, True, 0)

        toolbar = NavigationToolbar2(canvas, sw)
        self.widget.pack_start(toolbar, False, False, 0)
        self.widget.add(sw)
开发者ID:cfobel,项目名称:webcam-recorder,代码行数:16,代码来源:view.py

示例9: __init__

    def __init__(self, plot, width=500, height=500):
        super(PlotWidget, self).__init__()

        self.widget = FigureCanvas(plot.get_figure())
        self.plot = plot

        self.widget.set_size_request(width, height)
        self.widget.show_all()
开发者ID:naojsoft,项目名称:ginga,代码行数:8,代码来源:Plot.py

示例10: onGoPressed

    def onGoPressed(self, button):
        symbol = self.symbol.get_text()
        asset = pd.io.data.DataReader(symbol, 'yahoo')

        figure = Figure(figsize=(5, 4), dpi=100, frameon=False)
        subplot = figure.add_subplot(1, 1, 1)
        subplot.plot(asset.index, asset['Adj Close'])
        subplot.autoscale_view(True, True, True)

        canvas = FigureCanvas(figure)
        canvas.set_size_request(500, 250)

        sw = self.app.builder.get_object('scrolledwindow1')
        # remove old children
        for child in sw.get_children():
            sw.remove(child)
        sw.add(canvas)
        sw.show_all()
开发者ID:Hillash,项目名称:QuantPy,代码行数:18,代码来源:app.py

示例11: init_gui

    def init_gui(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file("finally.glade")

        self.builder.connect_signals( 
                                    {
                                      "window_destroy"  : self.window_destroy,
                                      "press_button"    : self.press_button,
                                      "clear_text"      : self.clear_text,
                                      "remove_last_char": self.remove_last_char,
                                      "calculate"       : self.calculate,
                                      "switch_page"     : self.switch_page,
                                      "num_base_change" : self.num_base_change,
                                      "fix_cursor"      : self.fix_cursor,
                                      "enable_textview" : self.enable_textview,
                                      "disable_textview": self.disable_textview,
                                      "prog_calc"       : self.prog_calc,
                                      "back_to_future"  : self.back_to_future,
                                      "plot"            : self.plot
                                    }
                                    )

        self.window = self.builder.get_object("main_window")
        self.window.set_size_request(250,305)
        self.window.set_title("The Calculator")
        self.window.set_icon_from_file("/usr/share/pixmaps/thecalculator-icon.png")
        self.text_buff = self.builder.get_object("class_17").get_buffer()  # Access buffer from TextView
        self.builder.get_object("class_17").grab_focus()
        self.builder.get_object("radiobutton3").set_active(True)
        self.num_base_change(self.builder.get_object("radiobutton3"))

        ############### PLOT FUNCTION ##############

        sw = self.builder.get_object("scrolledwindow1")
        sw2 = self.builder.get_object("scrolledwindow2")

        fig = Figure(figsize=(5,5),dpi=120)
        self.ax = fig.add_subplot(111)

        self.x = arange(-3.1415,3.1415,0.01)
        self.y = sin(self.x)

        self.ax.plot(self.x,self.y,label="sin(x)")
        self.ax.set_xlim(-3.2,3.2)
        self.ax.set_ylim(-1.2,1.2)
        self.ax.grid(True)

        fig.set_size_inches(9.5, 5.5, forward=True)

        fig.tight_layout()

        self.canvas = FigureCanvas(fig)
        sw.add_with_viewport(self.canvas)
        self.canvas.show()

        toolbar = NavigationToolbar(self.canvas, self.window)
        sw2.add_with_viewport(toolbar)
开发者ID:barvirm,项目名称:The-Calculator-v2.0,代码行数:57,代码来源:main.py

示例12: __init__

    def __init__(self, main_window, settings, data, add_layer_dataset, add_feature, redraw_main):
        """
        Initializes the RotationDialog class.

        Requires the main_window object, the settings object (PlotSettings
        class) and the data rows to initialize. All the necessary widgets are
        loaded from the Glade file. A matplotlib figure is set up and added
        to the scrolledwindow. Two axes are set up that show the original and
        rotated data.
        """
        self.builder = Gtk.Builder()
        self.builder.set_translation_domain(i18n().get_ts_domain())
        script_dir = os.path.dirname(__file__)
        rel_path = "gui_layout.glade"
        abs_path = os.path.join(script_dir, rel_path)
        self.builder.add_objects_from_file(abs_path,
            ("dialog_rotation", "adjustment_rotation_dipdir",
             "adjustment_rotation_dip", "adjustment_rotation_angle"))
        self.dialog = self.builder.get_object("dialog_rotation")
        self.dialog.set_transient_for(main_window)
        self.settings = settings
        self.data = data
        self.trans = self.settings.get_transform()
        self.add_layer_dataset = add_layer_dataset
        self.add_feature = add_feature
        self.redraw_main = redraw_main

        self.adjustment_rotation_dipdir = self.builder.get_object("adjustment_rotation_dipdir")
        self.adjustment_rotation_dip = self.builder.get_object("adjustment_rotation_dip")
        self.adjustment_rotation_angle = self.builder.get_object("adjustment_rotation_angle")

        self.spinbutton_rotation_dipdir = self.builder.get_object("spinbutton_rotation_dipdir")
        self.spinbutton_rotation_dip = self.builder.get_object("spinbutton_rotation_dip")
        self.spinbutton_rotation_angle = self.builder.get_object("spinbutton_rotation_angle")

        self.scrolledwindow_rotate = self.builder.get_object("scrolledwindow_rotate")

        self.fig = Figure(dpi=self.settings.get_pixel_density())
        self.canvas = FigureCanvas(self.fig)
        self.scrolledwindow_rotate.add_with_viewport(self.canvas)

        gridspec = GridSpec(1, 2)
        original_sp = gridspec.new_subplotspec((0, 0),
                                             rowspan=1, colspan=1)
        rotated_sp = gridspec.new_subplotspec((0, 1),
                                           rowspan=1, colspan=1)
        self.original_ax = self.fig.add_subplot(original_sp,
                                         projection=self.settings.get_projection())
        self.rotated_ax = self.fig.add_subplot(rotated_sp,
                                         projection=self.settings.get_projection())

        self.canvas.draw()
        self.redraw_plot()
        self.dialog.show_all()
        self.builder.connect_signals(self)
        if sys.platform == "win32":
            translate_gui(self.builder)
开发者ID:gbtami,项目名称:innstereo,代码行数:57,代码来源:rotation_dialog.py

示例13: run_inner

 def run_inner(self, endog, exog, **kwargs ):
     
     signs = ['x', '+']
     colours = ['r', 'b']
             
     f = plt.figure()
     
     var_index = 0
     for var in exog.columns:
         sign = signs[var_index % len( signs )]
         colour = colours[var_index % len( colours )]
         plt.plot( endog, exog[var], colour+sign )
         var_index += 1
     
     canvas = FigureCanvas( f )
     
     self.ui.output_vbox.pack_start( canvas, True, True, 0 )
     canvas.show()
     self.ui.output_dialog.run()
     self.ui.output_dialog.hide()
开发者ID:toobaz,项目名称:grimm,代码行数:20,代码来源:actions_matplotlib.py

示例14: setup

    def setup(self):
        fig = Figure(figsize=(10, 10), dpi=100, facecolor="white", edgecolor="white")
        self.ax = fig.add_subplot(111)
        fig.subplots_adjust(left=0.1, right=0.90, top=0.95, bottom=0.05)
        # ensure the pie is round
        self.ax.set_aspect('equal')

        matplotlib.rc('font', family="sans", weight="normal", size=9)

        self.plot = FigureCanvas(fig)
        self.pack_start(self.plot, True, True, 0)
开发者ID:avernusheros,项目名称:avernus,代码行数:11,代码来源:charts.py

示例15: __init__

    def __init__(self, pid):
        Gtk.Window.__init__(self, title="Auto-tune")
        self.pid = pid
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        f = matplotlib.figure.Figure()
        self.axes = f.add_subplot(111)
        self.axes.set_xlabel('Time (sec.)')
        self.axes.set_ylabel('Temperature (C)')
        self.axes.autoscale()
        self.out_axes = self.axes.twinx()
        self.out_axes.set_ylabel('OUT (%)')
        self.out_axes.autoscale()
        self.axes.grid()
        self.pv_x = []
        self.pv_y = []
        self.sv_x = []
        self.sv_y = []
        self.out_x = []
        self.out_y = []
        self.pv_plot, = self.axes.plot(self.pv_x, self.pv_y, 'b--') #b
        self.sv_plot, = self.axes.plot(self.sv_x, self.sv_y, 'k-') #k
        self.out_plot, = self.out_axes.plot(self.out_x, self.out_y, 'r:') #r

        self.canvas = FigureCanvas(f)
        self.canvas.set_size_request(800,600)

        vbox.add(self.canvas)

        hbox = Gtk.Box()

        self.start = Gtk.Button('Start', Gtk.STOCK_EXECUTE)
        self.start.connect('clicked', self.on_start)
        self.start.set_sensitive(False)
        hbox.pack_start(self.start, False, False, 0)

        self.stop = Gtk.Button('Stop', Gtk.STOCK_STOP)
        self.stop.connect('clicked', self.on_stop)
        self.stop.set_sensitive(False)
        hbox.pack_start(self.stop, False, False, 0)

        button = Gtk.Button('Close', Gtk.STOCK_CLOSE)
        button.connect('clicked', self.on_close)
        hbox.pack_end(button, False, False, 0)

        vbox.add(hbox)

        self.add(vbox)
        self.run = True
        self.start_at = True
        self.stop_at = False
        self.d = self.loop()
        self.d.addErrback(lambda x: None)
        self.connect('delete-event', self.on_delete)
开发者ID:RickCarmichael,项目名称:set64rs,代码行数:54,代码来源:autotune.py


注:本文中的matplotlib.backends.backend_gtk3cairo.FigureCanvasGTK3Cairo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。