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


Python NavigationToolbar2QTAgg.setVisible方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QTAgg.setVisible方法的具体用法?Python NavigationToolbar2QTAgg.setVisible怎么用?Python NavigationToolbar2QTAgg.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg的用法示例。


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

示例1: FigureWidget

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import setVisible [as 别名]
class FigureWidget(QtGui.QWidget):
    """Matplotlib Figure widget to display CPU utilization"""

    def __init__(self, parent=None, title="Figrue", point_num=300, x=[], y=[]):
        super(FigureWidget, self).__init__(parent)

        # 数据初始化
        self.x = x
        self.y = y
        # 绘图控件初始化
        self.fig = Figure(figsize=(20, 6))
        self.fig.subplots_adjust(left=0.05, bottom=0.1, right=0.95, top=0.9, wspace=None, hspace=None)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(self)
        self.mpl_toolbar = NavigationToolbar(self.canvas, self)
        self.mpl_toolbar.setVisible(False)

        # 控件摆放设置
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.canvas)
        vbox.addWidget(self.mpl_toolbar)
        # vbox.addLayout(hbox)
        self.setLayout(vbox)

        # 创建右键菜单
        # self.createContextMenu()

        # 设置子图属性
        self.ax = self.fig.add_subplot(111)
        self.ax.set_title(title)
        # self.ax.patch.set_facecolor('#888888')
        self.ax.autoscale_view()
        self.data, = self.ax.plot(self.x, self.y, label='analysis')
        self.ax.legend()
        # # force a redraw of the Figure

        self.fig.canvas.draw()
开发者ID:dragondjf,项目名称:MetroMathPlot,代码行数:39,代码来源:figurewidget.py

示例2: AppForm

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import setVisible [as 别名]

#.........这里部分代码省略.........
				hh = self.tableview.horizontalHeader()
				hh.setStretchLastSection(True)
		elif expression[:8] == "METHOD==":
			method = expression[8:]
			temp = []
			for a in self.tabledata:
				if a[2] == method:
					temp.append(a)
					
			if len(temp) == 0:
				QMessageBox.about(self, "Ooopps", "METHOD enterred is either wrong or there isn't entry for this.")		
			else:		
				tablemodel = MyTableModel(self, temp, self.header)
				self.tableview.setModel(tablemodel) 
				self.tableview.resizeColumnsToContents()   	 	
				hh = self.tableview.horizontalHeader()
				hh.setStretchLastSection(True)
		
		else:
			if len(self.tabledata) == 0:
				QMessageBox.about(self, "Ooopps", "Table is empty")		
			else:
				QMessageBox.about(self, "Ooopps", "Check your enterred expression!!")        		
    def up(self):
    	print "Up"
    	
    def myrefresh(self):
    	print "refresh"	
    	
    def down(self):
    	print "down"    
        
    def show_graph(self):
		self.tableview.setVisible(False)
		self.list.setVisible(False)
		print "graph" 
		self.canvas.setVisible(True)
		self.mpl_toolbar.setVisible(True)
		self.on_draw()

    def show_table(self):
		self.canvas.setVisible(False)
		self.mpl_toolbar.setVisible(False)
		print "show_table"
		self.tableview.setVisible(True)
		self.list.setVisible(True)

    
    def myopen(self):
		print "open" 

		self.tabledata = []
		self.data = []
		filename = QFileDialog.getOpenFileName(self, 'Open File', '/')
		print filename
		
		f = open(filename,'r+')

		for line in f:
			matchObj = re.match( r'(.*?) (.*?) (.*?) \[(.*?) (.*?)\] "(.*?) (.*?) (.*?)" (.*?) (.*?) "(.*?)" "(.*)"', line, re.M|re.I)
			if matchObj:
				a = (matchObj.group(1),matchObj.group(4),matchObj.group(6),matchObj.group(9),matchObj.group(10),matchObj.group(7))      
				self.tabledata.append(a)
				b = (matchObj.group(1),matchObj.group(2),matchObj.group(3),matchObj.group(4),matchObj.group(5),matchObj.group(6),matchObj.group(7),matchObj.group(8),matchObj.group(9),matchObj.group(10),matchObj.group(11),matchObj.group(12))
				self.data.append(b)
        
开发者ID:HimanshuPurandare,项目名称:Projects,代码行数:69,代码来源:WeblogAnalyzer.py

示例3: geopunt4QgisElevationDialog

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import setVisible [as 别名]
class geopunt4QgisElevationDialog(QtGui.QDialog):
    def __init__(self, iface):
        QtGui.QDialog.__init__(self, None)
        self.setWindowFlags( self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint )
        #self.setWindowFlags( self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
        
        self.iface = iface
    
        # initialize locale
        locale = QtCore.QSettings().value("locale/userLocale", "nl")
        if not locale: locale == 'nl' 
        else: locale = locale[0:2]
        localePath = os.path.join(os.path.dirname(__file__), 'i18n', 'geopunt4qgis_{}.qm'.format(locale))
        if os.path.exists(localePath):
            self.translator = QtCore.QTranslator()
            self.translator.load(localePath)
            if QtCore.qVersion() > '4.3.3': QtCore.QCoreApplication.installTranslator(self.translator)
    
        self._initGui()

    def _initGui(self):
        """setup the user interface"""
        self.ui = Ui_elevationDlg()
        self.ui.setupUi(self)
                
        #get settings
        self.s = QtCore.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( QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed )
        self.ui.verticalLayout.addWidget(self.bar)
        
        self.ui.buttonBox.addButton(QtGui.QPushButton("Sluiten"), QtGui.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 )

    def createCanvasToolbar (self):
        '''
        1 Reset original view
        2 Back to  previous view
        3 Forward to next view
        4 Pan axes with left mouse, zoom with right
        5 Zoom to rectangle
        6 Save the figure
        7 Edit curves line and axes parameters
        '''
        self.toolbar.setVisible(False)
        toolbarBtns = self.ui.toolbar.findChildren(QtGui.QToolButton)
        self.ui.toolbar.setStyleSheet("""QToolButton {border-width: 2px; border-style:            
                                                      outset; border-color: #fbd837; border-radius: 5px ;
                                                      background-color: white }
                                         QToolButton:pressed { border-style: inset; 
                                                             background-color: grey } """)
        toolbarBtns[0].setToolTip(QtCore.QCoreApplication.translate(
                                            "geopunt4QgisElevationDialog", "Keer terug naar overzicht"))
        toolbarBtns[0].setIcon( QtGui.QIcon(":/plugins/geopunt4Qgis/images/full_extent.png"))
        toolbarBtns[0].clicked.connect( self.toolbar.home )
        toolbarBtns[1].setToolTip(QtCore.QCoreApplication.translate(
                                            "geopunt4QgisElevationDialog", "Vorige"))
        toolbarBtns[1].setIcon( QtGui.QIcon(":/plugins/geopunt4Qgis/images/previous.png")) 
        toolbarBtns[1].clicked.connect( self.toolbar.back )
        toolbarBtns[2].setToolTip(QtCore.QCoreApplication.translate(
#.........这里部分代码省略.........
开发者ID:An0305,项目名称:geopunt4Qgis,代码行数:103,代码来源:geopunt4QgisElevation.py


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