• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python backend_qt5agg.NavigationToolbar2QT类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: release_zoom

    def release_zoom(self, event):
        """
        override zoom released method
        """
        self.canvas_zoom_released.emit()

        NavigationToolbar2QT.release_zoom(self, event)
开发者ID:neutrons,项目名称:FastGR,代码行数:7,代码来源:navigationtoolbar.py


示例2: _update_view

    def _update_view(self):
        """
        view update called by home(), back() and forward()
        :return:
        """
        NavigationToolbar2QT._update_view(self)

        self._myParent.evt_view_updated()
开发者ID:neutrons,项目名称:FastGR,代码行数:8,代码来源:navigationtoolbar.py


示例3: draw

    def draw(self):
        """
        Canvas is drawn called by pan(), zoom()
        :return:
        """
        NavigationToolbar2QT.draw(self)

        self._myParent.evt_view_updated()
开发者ID:neutrons,项目名称:FastGR,代码行数:8,代码来源:navigationtoolbar.py


示例4: __init__

	def __init__(self, *args, **kwargs):
		NavigationToolbar2QT.__init__(self, *args, **kwargs)

		self.init_buttons()
		self.panAction.setCheckable(True)
		self.zoomAction.setCheckable(True)

		# remove the subplots action
		self.removeAction( self.subplotsAction )
开发者ID:faunalia,项目名称:ps-speed,代码行数:9,代码来源:plot_wdg.py


示例5: __init__

    def __init__(self, canvas_, parent_):
#        backend.figureoptions = None  # Monkey patched to kill the figure options button on matplotlib toolbar

#        self.toolitems = (
#            ('Home', 'Reset original view', 'home', 'home'),
#            ('Back', 'Back to previous view', 'back', 'back'),
#            ('Forward', 'Forward to next view', 'forward', 'forward'),
#            (None, None, None, None),
#            ('Pan', 'Pan axes with left mouse, zoom with right', 'move', 'pan'),
#            ('Zoom', 'Zoom to rectangle', 'zoom_to_rect', 'zoom'),
#            (None, None, None, None),
#            ('Save', 'Save the current image', 'filesave', 'save_figure'),
#            )
        NavigationToolbar2QT.__init__(self, canvas_, parent_)
开发者ID:somesortoferror,项目名称:specton,代码行数:14,代码来源:spcharts.py


示例6: zoom

    def zoom(self, *args):
        """
        Turn on/off zoom (zoom button)
        :param args:
        :return:
        """
        NavigationToolbar2QT.zoom(self, args)

        if self._myMode == NAVIGATION_MODE_ZOOM:
            # out of zoom mode
            self._myMode = NAVIGATION_MODE_NONE
        else:
            # into zoom mode
            self._myMode = NAVIGATION_MODE_ZOOM
开发者ID:neutrons,项目名称:FastGR,代码行数:14,代码来源:navigationtoolbar.py


示例7: __init__

    def __init__(self, parent, canvas):
        """ Initialization
        built-in methods
        - drag_zoom(self, event): triggered during holding the mouse and moving
        """
        NavigationToolbar2QT.__init__(self, canvas, canvas)

        # parent
        self._myParent = parent
        # tool bar mode
        self._myMode = NAVIGATION_MODE_NONE

        # connect the events to parent
        self.home_button_pressed.connect(self._myParent.evt_toolbar_home)
        self.canvas_zoom_released.connect(self._myParent.evt_zoom_released)
开发者ID:neutrons,项目名称:FastGR,代码行数:15,代码来源:navigationtoolbar.py


示例8: pan

    def pan(self, *args):
        """

        :param args:
        :return:
        """
        NavigationToolbar2QT.pan(self, args)

        if self._myMode == NAVIGATION_MODE_PAN:
            # out of pan mode
            self._myMode = NAVIGATION_MODE_NONE
        else:
            # into pan mode
            self._myMode = NAVIGATION_MODE_PAN

        print('PANNED')
开发者ID:neutrons,项目名称:FastGR,代码行数:16,代码来源:navigationtoolbar.py


示例9: MyMplCanvas

class MyMplCanvas(FigureCanvas):
    """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""

    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 = []

    def compute_initial_figure(self):
        pass
开发者ID:saknayo,项目名称:sspainter,代码行数:31,代码来源:_FigurePlotModule.py


示例10: press_zoom

def press_zoom(self, event):
    """
    Method that is used to limit zoom to the x axis. Based on
    http://stackoverflow.com/a/16709952/5215507
    """
    event.key = 'x'
    NavigationToolbar.press_zoom(self, event)
开发者ID:gkunter,项目名称:coquery,代码行数:7,代码来源:textgridview.py


示例11: matplotlibWidget

class matplotlibWidget(QWidget):
    def __init__(self, parent = None):
        QWidget.__init__(self, parent)
        self.canvas = MplCanvas()
        self.gl = QGridLayout()
        alignment = Qt.Alignment()
        self.gl.addWidget(self.canvas,0,0,-1,-1,alignment)

        self.toolbar = NavigationToolbar(self.canvas, self)
        self.toolbar.hide()

        # Just some button 

        self.button1 = QPushButton('Zoom')
        self.button1.clicked.connect(self.zoom)

        self.button2 = QPushButton('Pan')
        self.button2.clicked.connect(self.pan)

        self.button3 = QPushButton('Home')
        self.button3.clicked.connect(self.home)

        self.gl.addWidget(self.toolbar,1,0,alignment)
        self.gl.addWidget(self.button1,1,1,alignment)
        self.gl.addWidget(self.button2,1,2,alignment)
        self.gl.addWidget(self.button3,1,3,alignment)

        self.setLayout(self.gl)

    def home(self):
        self.toolbar.home()
    def zoom(self):
        self.toolbar.zoom()
    def pan(self):
        self.toolbar.pan()
开发者ID:dipanjan92,项目名称:ANN-Simulator,代码行数:35,代码来源:app.py


示例12: __init__

    def __init__(self, parent=None):
        super(Widgetmain, self).__init__(parent)

        self.figure = Figure()

        # plt.subplots_adjust(left=0.031, right=0.999, top=0.99, bottom=0.03)
        # plt.subplots_adjust(left=0.001, right=0.999, top=0.999, bottom=0.001)

        self.canvas = FigureCanvas(self.figure)

        self.toolbar = NavigationToolbar(self.canvas, self)

        # uncomment for disabling plot toolbar, not recommended
        self.toolbar.hide()

        # set the layout
        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget(self.toolbar)
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        # set the plot class handlers
        self.wzoom = plot_tools.WheellZoom()
        self.adapt = plot_tools.WindowResize()  # keep tight layout
        self.cursor = plot_tools.SnaptoCursor()
        self.selector = plot_tools.Select()
        self.selection = plot_tools.Selection()
        self.dataplot = None
开发者ID:Pymatteo,项目名称:QtNMR,代码行数:28,代码来源:graphics.py


示例13: addmpl

 def addmpl(self, fig):
     self.canvas = FigureCanvas(fig)
     self.canvas.mpl_connect('button_press_event',self.on_click)
     self.mplvl.addWidget(self.canvas)
     self.canvas.draw()
     self.toolbar = NavigationToolbar(self.canvas,self.mplwindow,coordinates=True)
     self.mplvl.addWidget(self.toolbar)
开发者ID:ntejos,项目名称:joebvp,代码行数:7,代码来源:VPmeasure.py


示例14: addmpl

 def addmpl(self):
     # add plot to anvas
     self.rmmpl()
     self.canvas = FigureCanvas(self.fig)
     self.mplvl.addWidget(self.canvas)
     self.canvas.draw()
     self.toolbar = NavigationToolbar(self.canvas, self.mplwindow)
     self.mplvl.addWidget(self.toolbar)
开发者ID:lewisfish,项目名称:data_cube_viewer,代码行数:8,代码来源:custommpl.py


示例15: __init__

    def __init__(self, parent, settingsdict1={}, obsid=''):
        utils.start_waiting_cursor()#show the user this may take a long time...
        self.obsid = obsid
        self.log_pos = None
        self.y_pos = None
        self.meas_ts = None
        self.head_ts = None
        self.head_ts_for_plot = None
        self.level_masl_ts = None
        self.loggerpos_masl_or_offset_state = 1

        self.settingsdict = settingsdict1
        qgis.PyQt.QtWidgets.QDialog.__init__(self, parent)
        self.setAttribute(qgis.PyQt.QtCore.Qt.WA_DeleteOnClose)
        self.setupUi(self) # Required by Qt4 to initialize the UI
        self.setWindowTitle(ru(QCoreApplication.translate('Calibrlogger', "Calculate water level from logger"))) # Set the title for the dialog
        self.INFO.setText(ru(QCoreApplication.translate('Calibrlogger', "Select the observation point with logger data to be adjusted.")))
        self.log_calc_manual.setText("<a href=\"https://github.com/jkall/qgis-midvatten-plugin/wiki/4.-Edit-data\">Midvatten manual</a>")
      
        # Create a plot window with one single subplot
        self.calibrplotfigure = plt.figure()
        self.axes = self.calibrplotfigure.add_subplot( 111 )
        self.canvas = FigureCanvas( self.calibrplotfigure )
        self.mpltoolbar = NavigationToolbar( self.canvas, self.widgetPlot )
        self.layoutplot.addWidget( self.canvas )
        self.layoutplot.addWidget( self.mpltoolbar )

        self.show()

        self.cid =[]
                
        self.pushButtonSet.clicked.connect(lambda x: self.set_logger_pos())
        self.pushButtonAdd.clicked.connect(lambda x: self.add_to_level_masl())
        self.pushButtonFrom.clicked.connect(lambda x: self.set_from_date_from_x())
        self.pushButtonTo.clicked.connect(lambda x: self.set_to_date_from_x())
        self.L1_button.clicked.connect(lambda x: self.set_adjust_data('L1_date', 'L1_level'))
        self.L2_button.clicked.connect(lambda x: self.set_adjust_data('L2_date', 'L2_level'))
        self.M1_button.clicked.connect(lambda x: self.set_adjust_data('M1_date', 'M1_level'))
        self.M2_button.clicked.connect(lambda x: self.set_adjust_data('M2_date', 'M2_level'))
        self.pushButton_from_extent.clicked.connect(lambda: self.FromDateTime.setDateTime(num2date(self.axes.get_xbound()[0])))
        self.pushButton_to_extent.clicked.connect(lambda: self.ToDateTime.setDateTime(num2date(self.axes.get_xbound()[1])))
        self.pushButtonupdateplot.clicked.connect(lambda x: self.update_plot())
        self.pushButtonLpos.clicked.connect(lambda x: self.catch_old_level())
        self.pushButtonMpos.clicked.connect(lambda x: self.catch_new_level())
        self.pushButtonMpos.setEnabled(False)
        self.pushButtonCalcBestFit.clicked.connect(lambda x: self.logger_pos_best_fit())
        self.pushButtonCalcBestFit.setToolTip(ru(QCoreApplication.translate('Calibrlogger', 'This will calibrate all values inside the chosen period\nusing the mean difference between head_cm and w_levels measurements.\n\nThe search radius is the maximum time distance allowed\n between a logger measurement and a w_level measurement.')))
        self.pushButtonCalcBestFit2.clicked.connect(lambda x: self.level_masl_best_fit())
        self.pushButtonCalcBestFit2.setToolTip(ru(QCoreApplication.translate('Calibrlogger', 'This will calibrate all values inside the chosen period\nusing the mean difference between level_masl and w_levels measurements.\n\nThe search radius is the maximum time distance allowed\n between a logger measurement and a w_level measurement.')))
        self.pushButton_delete_logger.clicked.connect(lambda: self.delete_selected_range('w_levels_logger'))
        self.adjust_trend_button.clicked.connect(lambda x: self.adjust_trend_func())

        self.get_search_radius()

        # Populate combobox with obsid from table w_levels_logger
        self.load_obsid_from_db()

        utils.stop_waiting_cursor()#now this long process is done and the cursor is back as normal
开发者ID:jkall,项目名称:qgis-midvatten-plugin,代码行数:58,代码来源:wlevels_calc_calibr.py


示例16: __init__

 def __init__(self):
   super(Scanner, self).__init__()
   self.setupUi(self)
   # IP address validator
   rx = QRegExp('^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$')
   self.addrValue.setValidator(QRegExpValidator(rx, self.addrValue))
   # state variable
   self.idle = True
   # number of samples to show on the plot
   self.size = 512 * 512
   self.freq = 143.0
   # buffer and offset for the incoming samples
   self.buffer = bytearray(8 * self.size)
   self.offset = 0
   self.data = np.frombuffer(self.buffer, np.int32)
   # create figure
   figure = Figure()
   figure.set_facecolor('none')
   self.axes = figure.add_subplot(111)
   self.canvas = FigureCanvas(figure)
   self.plotLayout.addWidget(self.canvas)
   self.axes.axis((0.0, 512.0, 0.0, 512.0))
   x, y = np.meshgrid(np.linspace(0.0, 512.0, 513), np.linspace(0.0, 512.0, 513))
   z = x / 512.0 + y * 0.0
   self.mesh = self.axes.pcolormesh(x, y, z, cmap = cm.plasma)
   # create navigation toolbar
   self.toolbar = NavigationToolbar(self.canvas, self.plotWidget, False)
   # remove subplots action
   actions = self.toolbar.actions()
   if int(matplotlib.__version__[0]) < 2:
     self.toolbar.removeAction(actions[7])
   else:
     self.toolbar.removeAction(actions[6])
   self.plotLayout.addWidget(self.toolbar)
   # create TCP socket
   self.socket = QTcpSocket(self)
   self.socket.connected.connect(self.connected)
   self.socket.readyRead.connect(self.read_data)
   self.socket.error.connect(self.display_error)
   # connect signals from buttons and boxes
   self.connectButton.clicked.connect(self.start)
   self.scanButton.clicked.connect(self.scan)
   self.periodValue.valueChanged.connect(self.set_period)
   self.trgtimeValue.valueChanged.connect(self.set_trgtime)
   self.trginvCheck.stateChanged.connect(self.set_trginv)
   self.shdelayValue.valueChanged.connect(self.set_shdelay)
   self.shtimeValue.valueChanged.connect(self.set_shtime)
   self.shinvCheck.stateChanged.connect(self.set_shinv)
   self.acqdelayValue.valueChanged.connect(self.set_acqdelay)
   self.samplesValue.valueChanged.connect(self.set_samples)
   self.pulsesValue.valueChanged.connect(self.set_pulses)
   # create timers
   self.startTimer = QTimer(self)
   self.startTimer.timeout.connect(self.timeout)
   self.meshTimer = QTimer(self)
   self.meshTimer.timeout.connect(self.update_mesh)
   # set default values
   self.periodValue.setValue(200.0)
开发者ID:pavel-demin,项目名称:red-pitaya-notes,代码行数:58,代码来源:scanner.py


示例17: MatplotlibWidget

class MatplotlibWidget(QWidget):

    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.frame = QWidget()
        self.canvas = MplCanvas()
        self.canvas.setParent(self.frame)
        self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame)
        self.vbl = QVBoxLayout()
        self.vbl.addWidget(self.canvas)
        self.vbl.addWidget(self.mpltoolbar)
        self.setLayout(self.vbl)

        self.mpltoolbar.toggleViewAction()

    def setTitle(self, text):
        """
        Sets the figure title
        """
        self.canvas.setTitle(text)

    def get_axis(self):
        return self.canvas.ax

    def get_figure(self):
        return self.canvas.fig

    def clear(self, force=False):
        if force:
            self.canvas.fig.clear()
            self.canvas.ax = self.canvas.fig.add_subplot(111)
            # self.canvas.ax.clear()
            # self.canvas = MplCanvas()
        else:
            self.canvas.ax.clear()

    def redraw(self):
        self.canvas.ax.figure.canvas.draw()

    def plot(self, x, y, title='', xlabel='', ylabel=''):
        self.setTitle(title)
        self.canvas.ax.plot(x, y)

        self.redraw()
开发者ID:SanPen,项目名称:GridCal,代码行数:45,代码来源:matplotlibwidget.py


示例18: _initGui

    def _initGui(self):
        """setup the user interface"""
        self.ui = Ui_elevationDlg()
        self.ui.setupUi(self)
                
        #get settings
        self.s = QSettings()
        self.loadSettings()

        self.gh = geometryHelper( self.iface )
        self.eh = elevationHelper( self.iface, self.startDir)
        
        #setup a message bar
        self.bar = QgsMessageBar() 
        self.bar.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Fixed )
        self.ui.verticalLayout.addWidget(self.bar)
        
        self.ui.buttonBox.addButton(QPushButton("Sluiten"), QDialogButtonBox.RejectRole )
        for btn in self.ui.buttonBox.buttons():
            btn.setAutoDefault(0)
                  
        ##graph global vars
        self.Rubberline =  None
        self.profile = None
        self.pt = None
        self.ax = None
        self.ano = None
        self.anoLbl = None
        self.counter = 0
        self.xscaleUnit = (1, "m")
        
        # a figure instance to plot on
        self.figure = Figure()

        #create the Canvas widget and toolbar and set graphWgt as parent
        self.canvas = FigureCanvas(self.figure)
        self.toolbar = NavigationToolbar(self.canvas, self)

        ###
        #self.ui.toolbar.layout().insertWidget(0, self.toolbar)
        self.ui.graphWgt.layout().addWidget(self.canvas)
        self.createCanvasToolbar()
        
        #events
        self.ui.drawBtn.clicked.connect(self.drawBtnClicked)
        self.figure.canvas.mpl_connect('motion_notify_event', self.showGraphMotion)
        self.ui.saveLineBtn.clicked.connect(self.saveLineClicked)
        self.ui.savePntBtn.clicked.connect(self.savePntClicked)
        self.ui.addDHMbtn.clicked.connect(self.addDHMasWMS) 
        self.ui.refreshBtn.clicked.connect( self.onRefresh )
        self.ui.buttonBox.helpRequested.connect(self.openHelp)
        
        self.rejected.connect(self.clean )
开发者ID:warrieka,项目名称:geopunt4Qgis,代码行数:53,代码来源:geopunt4QgisElevation.py


示例19: __init__

    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.frame = QWidget()
        self.canvas = MplCanvas()
        self.canvas.setParent(self.frame)
        self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame)
        self.vbl = QVBoxLayout()
        self.vbl.addWidget(self.canvas)
        self.vbl.addWidget(self.mpltoolbar)
        self.setLayout(self.vbl)

        self.mpltoolbar.toggleViewAction()
开发者ID:SanPen,项目名称:GridCal,代码行数:13,代码来源:matplotlibwidget.py


示例20: __init__

    def __init__(self, parent = None):

        # initialization of Qt MainWindow widget
        QtWidgets.QWidget.__init__(self, parent)
        
        # set the canvas to the Matplotlib widget
        self.canvas = MplCanvas()

        self.ntb = NavigationToolbar(self.canvas, self)
        
        #self.ntb.removeAction(self.ntb.buttons[0])
        self.ntb.clear()
        
        program_folder = os.path.join(os.path.dirname(__file__), "ims")

        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "world.png")), 'Home', self.zoom2fullextent)
        a.setToolTip('Reset original view')
        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "arrow_left.png")), 'Back', self.ntb.back)
        a.setToolTip('Back to previous view')
        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "arrow_right.png")), 'Forward', self.ntb.forward)
        a.setToolTip('Forward to next view')

        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "arrow_out.png")), 'Pan', self.ntb.pan)
        a.setToolTip('Pan axes with left mouse, zoom with right')
        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "zoom.png")), 'Zoom', self.ntb.zoom)
        a.setToolTip('Zoom to rectangle')

        action_SetSrcPt = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "bullet_red.png")), 'Source point', self.pt_map)
        action_SetSrcPt.setToolTip('Set source point in map') 

        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "camera.png")), 'Save',
                self.ntb.save_figure)
        a.setToolTip('Save map as image')

        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "help.png")), 'Help',
                self.openHelp)
        a.setToolTip('Help')
        
        a = self.ntb.addAction(self.ntb._icon(os.path.join(program_folder, "information.png")), 'About',
                self.helpAbout)
        a.setToolTip('About')        
                                            
        # create a vertical box layout
        self.vbl = QtWidgets.QVBoxLayout()
        
        # add widgets to the vertical box
        self.vbl.addWidget(self.canvas)
        self.vbl.addWidget(self.ntb)
                                                             
        # set the layout to the vertical box
        self.setLayout(self.vbl)        
开发者ID:mauroalberti,项目名称:gSurf,代码行数:51,代码来源:gSurf_mplwidget.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python backend_tkagg.FigureCanvasTkAgg类代码示例发布时间:2022-05-27
下一篇:
Python backend_qt5agg.FigureCanvasQTAgg类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap