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


Python backend_qt5agg.FigureCanvasQTAgg类代码示例

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


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

示例1: __init__

 def __init__(self):
     self._fig = Figure(dpi=170)
     FigureCanvasQTAgg.__init__(self, self._fig)
     FigureCanvasQTAgg.setSizePolicy(self,
                                     QtWidgets.QSizePolicy.Expanding,
                                     QtWidgets.QSizePolicy.Expanding)
     self._fig.subplots_adjust(left=0, right=1, top=1, bottom=0)
     self._mpl_toolbar = NavigationToolbar2QTAgg(self, self)
     self._mpl_toolbar.hide()
     self.__taking = False
     self._scale = 'log'
     self._scales = OrderedDict()
     self._scales['Logarithmic'] = 'log'
     self._scales['Linear'] = 'linear'
     self._scales['Square Root'] = 'sqrt'
     self._scales['Power'] = 'power'
     self._scales['Arc Sinh'] = 'arcsinh'
     self._gc = None
     self._upperCut = 99.75
     self._lowerCut = 0.25
     self._cmap = 'gray'
     self._refresh_timer = QtCore.QTimer(self)
     self._refresh_timer.setSingleShot(True)
     self._refresh_timer.timeout.connect(self._refreshConcrete)
     self.apertures = []
开发者ID:badders,项目名称:pyfitsview,代码行数:25,代码来源:fitsview.py

示例2: keyPressEvent

    def keyPressEvent(self, event):
        if self.redetecter:
            self.detecter()

        key = event.key()
        txt = event.text()
        modifiers = event.modifiers()
        accept = True
        debug("key: ", key)
        if key == Qt.Key_Delete and self.select:
            if shift_down(event):
                self.executer("%s.cacher()" %self.select.nom)
            else:
                self.executer("%s.supprimer()" %self.select.nom)
        elif key in (Qt.Key_Return, Qt.Key_Enter) and self.editeur.objet is not self.select:
            self.editer(shift_down(event))
        elif self.editeur and not self.editeur.key(key, txt, modifiers):
            accept = False

        if key == Qt.Key_Escape:
            if self.action_en_cours is not None:
                self.interrompre_action_en_cours()
            elif self.interaction:
                print("ESCAPE !")
                self.interaction(special="ESC")
                accept = True

        if not accept:
            FigureCanvasQTAgg.keyPressEvent(self, event)
开发者ID:wxgeo,项目名称:geophar,代码行数:29,代码来源:qtcanvas.py

示例3: MPLibWidget

class MPLibWidget(QtWidgets.QWidget):
    """
    base MatPlotLib widget
    """
    def __init__(self, parent=None):
        super(MPLibWidget, self).__init__(parent)
        
        self.figure = Figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.canvas.setParent(self)
        
        self.mpl_toolbar = NavigationToolbar2QT(self.canvas, self)
        
        self.canvas.mpl_connect('key_press_event', self.on_key_press)
        
        self.axes = self.figure.add_subplot(111)
        # self.axes.hold(False)

        self.compute_initial_figure()
        
        self.layoutVertical = QtWidgets.QVBoxLayout(self)
        self.layoutVertical.addWidget(self.canvas)
        self.layoutVertical.addWidget(self.mpl_toolbar)
        
    def on_key_press(self, event):
        """not working"""
        print('you pressed', event.key)
        # implement the default mpl key press events described at
        # http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts
        key_press_handler(event, self.canvas, self.mpl_toolbar)    
        
    def compute_initial_figure(self):
        pass
开发者ID:VDFaller,项目名称:Optical-Modeling,代码行数:33,代码来源:Main.py

示例4: mousePressEvent

 def mousePressEvent(self, event):
     button = event.button()
     if button == Qt.LeftButton:
         self.onLeftDown(event)
     elif button == Qt.RightButton:
         self.onRightDown(event)
     else:
         FigureCanvasQTAgg.mousePressEvent(self, event)
开发者ID:wxgeo,项目名称:geophar,代码行数:8,代码来源:qtcanvas.py

示例5: mouseReleaseEvent

 def mouseReleaseEvent(self, event):
     button = event.button()
     if button == Qt.LeftButton:
         self.onLeftUp(event)
     elif button == Qt.RightButton:
         self.onRightUp(event)
     else:
         FigureCanvasQTAgg.mouseReleaseEvent(self, event)
开发者ID:wxgeo,项目名称:geophar,代码行数:8,代码来源:qtcanvas.py

示例6: PlotWidget

class PlotWidget(QtWidgets.QWidget):
	def __init__(self, parent=None):
		QtWidgets.QWidget.__init__(self, parent)
		self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
		
		self.figure = plt.figure()
		
		self.canvas = FigureCanvas(self.figure)
		
		self.toolbar = NavigationToolbar(self.canvas, self)
		
		self.button = QtWidgets.QPushButton("Plot")
		self.button.clicked.connect(self.plot)
		
		layout = QtWidgets.QVBoxLayout()
		layout.addWidget(self.toolbar)
		layout.addWidget(self.canvas)
		layout.addWidget(self.button)
		
		self.setLayout(layout)
	
	def plot(self):
		data = [x for x in range(10)]
		
		ax = self.figure.add_subplot(111)
		
		ax.hold(False)
		
		ax.plot(data, "*-")
		
		self.canvas.draw()
开发者ID:neXyon,项目名称:pynephoscope,代码行数:31,代码来源:main.py

示例7: PlotWidget

class PlotWidget(Widgets.WidgetBase):

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

        self.widget = FigureCanvas(plot.get_figure())
        self.widget._resizeEvent = self.widget.resizeEvent
        self.widget.resizeEvent = self.resize_event
        self.plot = plot
        self.logger = plot.logger

    def set_plot(self, plot):
        self.plot = plot
        self.logger = plot.logger
        self.logger.debug("set_plot called")

    def configure_window(self, wd, ht):
        fig = self.plot.get_figure()
        fig.set_size_inches(float(wd) / fig.dpi, float(ht) / fig.dpi)

    def resize_event(self, event):
        rect = self.widget.geometry()
        x1, y1, x2, y2 = rect.getCoords()
        width = x2 - x1
        height = y2 - y1

        if width > 0 and height > 0:
            self.configure_window(width, height)
            self.widget._resizeEvent(event)
开发者ID:,项目名称:,代码行数:29,代码来源:

示例8: __init__

    def __init__(self, parent=None, 
                 width=4, height=3, dpi=100, 
                 use_seaborn=False,
                 style=0, context=0):
        self.seaborn = use_seaborn
        if use_seaborn:
            import seaborn as sns
            sns.set_style(self.SEABORN_STYLE[style])
            sns.set_context(self.SEABORN_CONTEXT[context])

        # set matplitlib figure object
        self.fig = Figure(figsize=(width, height), dpi=int(dpi))
        self.axes = self.fig.add_subplot(111)
        self.axes.hold(True)

        # call constructor of FigureCanvas
        super(Figurecanvas, self).__init__(self.fig)
        self.setParent(parent)

        # expand plot area as large as possible
        FigureCanvas.setSizePolicy(self,
                                   QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        self.x_min = 0
        self.x_max = 30

        # set color map object
        self.__cm = matplotlib.cm.gist_rainbow
开发者ID:TaizoAyase,项目名称:FSECplotter2,代码行数:30,代码来源:figurecanvas.py

示例9: __init__

	def __init__(self):
		QWidget.__init__(self)
		self.win_list=windows()
		self.setFixedSize(900, 600)
		self.setWindowIcon(QIcon(os.path.join(get_image_file_path(),"doping.png")))
		self.setWindowTitle(_("Doping profile editor (www.gpvdm.com)")) 

		self.win_list.set_window(self,"doping")
		self.main_vbox=QVBoxLayout()

		toolbar=QToolBar()
		toolbar.setIconSize(QSize(48, 48))

		self.save = QAction(QIcon(os.path.join(get_image_file_path(),"save.png")), _("Save"), self)
		self.save.triggered.connect(self.callback_save)
		toolbar.addAction(self.save)

		spacer = QWidget()
		spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
		toolbar.addWidget(spacer)


		self.help = QAction(QIcon(os.path.join(get_image_file_path(),"help.png")), _("Help"), self)
		self.help.triggered.connect(self.callback_help)
		toolbar.addAction(self.help)

		self.main_vbox.addWidget(toolbar)

		self.fig = Figure(figsize=(5,4), dpi=100)
		self.ax1=None
		self.show_key=True
		canvas = FigureCanvas(self.fig)
		#canvas.set_background('white')
		#canvas.set_facecolor('white')
		canvas.figure.patch.set_facecolor('white')
		canvas.show()

		self.main_vbox.addWidget(canvas)

		self.tab = QTableWidget()
		self.tab.resizeColumnsToContents()

		self.tab.verticalHeader().setVisible(False)

		self.tab.clear()
		self.tab.setColumnCount(4)
		self.tab.setSelectionBehavior(QAbstractItemView.SelectRows)

		self.load()
		self.build_mesh()

		self.tab.cellChanged.connect(self.tab_changed)

		self.main_vbox.addWidget(self.tab)


		self.draw_graph()

		self.setLayout(self.main_vbox)
		return
开发者ID:roderickmackenzie,项目名称:gpvdm,代码行数:60,代码来源:doping.py

示例10: __init__

    def __init__(self, parent=None, width=6, height=4, dpi=110):
        """
        Init canvas.
        """

        self.fig = Figure(figsize=(width, height), dpi=dpi)

        # Here one can adjust the position of the CTX plot area.
        # self.axes = self.fig.add_subplot(111)
        self.axes = self.fig.add_axes([0.1, 0.1, 0.85, 0.85])
        self.axes.grid(True)
        self.axes.set_xlabel("(no data)")
        self.axes.set_ylabel("(no data)")

        FigureCanvas.__init__(self, self.fig)

        layout = QVBoxLayout(parent)
        layout.addWidget(self)
        parent.setLayout(layout)

        FigureCanvas.setSizePolicy(self,
                                   QSizePolicy.Expanding,
                                   QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)

        # next too lines are needed in order to catch keypress events in plot canvas by mpl_connect()
        FigureCanvas.setFocusPolicy(self, QtCore.Qt.ClickFocus)
        FigureCanvas.setFocus(self)
开发者ID:pytrip,项目名称:pytripgui,代码行数:28,代码来源:plot_volhist.py

示例11: ColorbarWidget

class ColorbarWidget(QWidget):

    def __init__(self, parent=None):
        super(ColorbarWidget, self).__init__(parent)
        fig = Figure()
        rect = 0.25, 0.05, 0.1, 0.90
        self.cb_axes = fig.add_axes(rect)
        self.canvas = FigureCanvas(fig)
        self.setLayout(QVBoxLayout())
        self.layout().addWidget(self.canvas)
        self.button = QPushButton("Update")
        self.layout().addWidget(self.button)
        self.button.pressed.connect(self._update_cb_scale)

        self._create_colorbar(fig)

    def _create_colorbar(self, fig):
        self.mappable = ScalarMappable(norm=SymLogNorm(0.0001, 1,vmin=-10., vmax=10000.),
                                  cmap=DEFAULT_CMAP)
        self.mappable.set_array([])
        fig.colorbar(self.mappable, ax=self.cb_axes, cax=self.cb_axes)

    def _update_cb_scale(self):
        self.mappable.colorbar.remove()
        rect = 0.25, 0.05, 0.1, 0.90
        self.cb_axes = self.canvas.figure.add_axes(rect)
        self.mappable = ScalarMappable(Normalize(30, 4300),
                                   cmap=DEFAULT_CMAP)
        self.mappable.set_array([])
        self.canvas.figure.colorbar(self.mappable, ax=self.cb_axes, cax=self.cb_axes)
        self.canvas.draw()
开发者ID:martyngigg,项目名称:sandbox,代码行数:31,代码来源:cbar.py

示例12: __init__

    def __init__(self, parent=None, width=5, height=4, dpi=100):
        fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = fig.add_subplot(111)
        # We want the axes cleared every time plot() is called
        self.axes.hold(False)

        self.compute_initial_figure()

        #
        FigureCanvas.__init__(self, fig)
        self.setParent(parent)
        self.setStyleSheet("{background-color:transparent;border:none;}")

        """FigureCanvas.setSizePolicy(self,
                                   QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)"""

        FigureCanvas.updateGeometry(self)

        self.tootlbar = NavigationToolbar(self, parent)
        self.tootlbar.hide()

        self.fid = 0
        self.data = []
        self.index = []
开发者ID:saknayo,项目名称:sspainter,代码行数:25,代码来源:_FigurePlotModule.py

示例13: plot_data

 def plot_data(self):
     if not self.has_graph:
         new_x = [mdates.datestr2num(x) for x in self.graph_x]
         plt.xlabel('Time')
         plt.ylabel('Count')
         ax = self.fig.add_subplot(111)
         ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))
         ax.plot(new_x, self.graph_y, 'r-')
         ax.get_xaxis().set_ticks([])
         #ax.get_yaxis().set_ticks([])
         self.canvas = FigureCanvas(self.fig)
         self.graph_layout.addWidget(self.canvas)
         self.canvas.draw()
         self.has_graph = True
     else:
         self.graph_layout.removeWidget(self.canvas)
         self.canvas.close()
         self.fig.clf()
         plt.xlabel('Time')
         plt.ylabel('Count')
         ax = self.fig.add_subplot(111)
         ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))
         new_x = [mdates.datestr2num(x) for x in self.graph_x]
         ax.plot(new_x, self.graph_y, 'r-')
         ax.get_xaxis().set_ticks([])
         #ax.get_yaxis().set_ticks([])
         self.canvas = FigureCanvas(self.fig)
         self.graph_layout.addWidget(self.canvas)
         self.canvas.draw()
开发者ID:jshodd,项目名称:SigmaSwiper,代码行数:29,代码来源:sigmaSwiper.py

示例14: create_canvas

 def create_canvas(self):  # pragma: no cover
     self.fig = Figure()
     canvas = FigureCanvas(self.fig)
     self.ui.mainLayout.addWidget(canvas)
     canvas.setFocusPolicy(QtCore.Qt.StrongFocus)
     # Add subplots
     gridspec = GridSpec(2, 4)
     self.map_ax = self.fig.add_subplot(
         gridspec.new_subplotspec((0, 0), rowspan=2, colspan=2)
     )
     self.spectrum_ax = self.fig.add_subplot(
         gridspec.new_subplotspec((0, 2), rowspan=1, colspan=2)
     )
     self.hist_ax = self.fig.add_subplot(
         gridspec.new_subplotspec((1, 2), rowspan=1, colspan=1)
     )
     self.edge_ax = self.fig.add_subplot(
         gridspec.new_subplotspec((1, 3), rowspan=1, colspan=1)
     )
     # Create the colorbar on the histogram axes
     self.cbar = plots.draw_histogram_colorbar(ax=self.hist_ax,
                                               cmap="viridis",
                                               norm=Normalize(0, 1))
     self.cbar.ax.set_xlabel("Map Value")
     # Adjust the margins
     self.fig.tight_layout(pad=0)
     self.fig.canvas.draw_idle()
开发者ID:m3wolf,项目名称:xanespy,代码行数:27,代码来源:qt_map_view.py

示例15: __init__

    def __init__(self):

        self.fig = Figure()
        FigureCanvas.__init__(self, self.fig)

        self.main_plot = None
        self.create_main_plot()
开发者ID:kn-bibs,项目名称:dotplot,代码行数:7,代码来源:figures_plot.py


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