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


Python FigureCanvasQTAgg.show方法代码示例

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


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

示例1: __init__

# 需要导入模块: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg import show [as 别名]
	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,代码行数:62,代码来源:doping.py

示例2: RadarUI

# 需要导入模块: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg import show [as 别名]
class RadarUI(QtWidgets.QWidget):
# class RadarUI(QtWidgets.QMainWindow):

    def __init__(self):
        super(RadarUI, self).__init__()
        self.__controller = None
        self.__init_ui()

    def __init_ui(self):
        remove_clutter = QtWidgets.QPushButton('Remove Clutter', self)
        restore_clutter = QtWidgets.QPushButton('Restore Clutter', self)

        remove_clutter.clicked.connect(self.remove_clutter)
        restore_clutter.clicked.connect(self.restore_clutter)

        buttons_layout = QtWidgets.QHBoxLayout()
        buttons_layout.addWidget(remove_clutter)
        buttons_layout.addWidget(restore_clutter)

        figure = Figure()
        self.__controller = controller.Controller(figure)
        self.__controller.update.connect(self.__update_label)

        ax = figure.add_subplot(212)
        self.__line, = ax.plot(range(10))

        self.__canvas = FigureCanvasQTAgg(figure)
        self.__canvas.show()

        self.__name_label = QtWidgets.QLabel("asdf")

        # main layout
        main_layout = QtWidgets.QVBoxLayout()
        main_layout.addStretch(1)
        main_layout.addWidget(self.__canvas)
        main_layout.addWidget(self.__name_label)
        main_layout.addLayout(buttons_layout)

        self.setLayout(main_layout)
        self.show()

    def remove_clutter(self):
        # todo
        x, y = self.__line.get_data()
        self.__line.set_ydata(y - 0.2 * x)
        self.__canvas.draw()

    def restore_clutter(self):
        # todo
        x, y = self.__line.get_data()
        self.__line.set_ydata(y + 0.2 * x)
        self.__canvas.draw()

    def run(self):
        self.__controller.run2()

    @QtCore.pyqtSlot(np.ndarray)
    def __update_label(self, value):
        self.__name_label.setText(str(value))
开发者ID:franciscoSoler,项目名称:mini,代码行数:61,代码来源:radar_ui.py

示例3: LiveGraphQt4

# 需要导入模块: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg import show [as 别名]
class LiveGraphQt4(Backend):
    """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""

    def show(self, delay=50):
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.canvas.show()

        self.timer = QtCore.QTimer(self.canvas)
        self.timer.timeout.connect(self.run)

        super().show(delay)
开发者ID:t--wagner,项目名称:pymeasure,代码行数:13,代码来源:liveplot.py

示例4: App

# 需要导入模块: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg import show [as 别名]
class App(QtWidgets.QMainWindow):
    def __init__(self, master, figure):
        super().__init__()
        self.__init_ui()
        # Create a container
        # frame = QtWidgets.QFrame(master)
        # Create 2 buttons
        button_left = QtWidgets.QPushButton('< Decrease Slope', self)
        button_right = QtWidgets.QPushButton('Increase Slope >', self)

        button_left.clicked.connect(self.decrease)
        button_right.clicked.connect(self.increase)

        buttons_layout = QtWidgets.QHBoxLayout()
        buttons_layout.addWidget(button_left)
        buttons_layout.addWidget(button_right)

        ax = figure.add_subplot(212)
        self.line, = ax.plot(range(10))

        self.__canvas = FigureCanvasQTAgg(figure)
        self.__canvas.show()
        master.addWidget(self.__canvas)
        master.addLayout(buttons_layout)

        central_widget = QtWidgets.QWidget()
        central_widget.setLayout(master)
        self.setCentralWidget(central_widget)

        self.show()

    def decrease(self):
        x, y = self.line.get_data()
        self.line.set_ydata(y - 0.2 * x)
        self.__canvas.draw()

    def increase(self):
        x, y = self.line.get_data()
        self.line.set_ydata(y + 0.2 * x)
        self.__canvas.draw()

    def __init_ui(self):

        self.resize(600, 500)
        self.__center()

        self.setWindowTitle('test')

        # self.__create_menu()
        self.__create_toolbar()

    def __create_menu(self):
        exit_action = QtWidgets.QAction(QtGui.QIcon('icon.jpg'), '&Exit', self)
        exit_action.setShortcut('Ctrl+Q')
        exit_action.setStatusTip('Exit application')
        exit_action.triggered.connect(QtWidgets.qApp.quit)

        menu_bar = self.menuBar()
        file_menu = menu_bar.addMenu('&File')
        file_menu.addAction(exit_action)

    def __create_toolbar(self):
        exit_action = QtWidgets.QAction(QtGui.QIcon('icon.jpg'), 'Exit', self)
        exit_action.setShortcut('Ctrl+Q')
        exit_action.triggered.connect(QtWidgets.qApp.quit)

        self.toolbar = self.addToolBar('Exit')
        self.toolbar.addAction(exit_action)

    def __center(self):
        qr = self.frameGeometry()
        cp = QtWidgets.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
开发者ID:franciscoSoler,项目名称:mini,代码行数:76,代码来源:hstack_example_pyqt.py

示例5: band_graph

# 需要导入模块: from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg import show [as 别名]
class band_graph(QWidget):
	def init(self):

		self.main_vbox = QVBoxLayout()

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

		self.tb_save = QAction(QIcon(os.path.join(get_image_file_path(),"save.svg")), "Save image", self)
		self.tb_save.setStatusTip(_("Close"))
		self.tb_save.triggered.connect(self.callback_save_image)
		toolbar.addAction(self.tb_save)

		self.main_vbox.addWidget(toolbar)

		self.my_figure=Figure(figsize=(5,4), dpi=100)
		self.canvas = FigureCanvas(self.my_figure)
		self.canvas.mpl_connect('key_press_event', self.press)
		self.canvas.setFocusPolicy( Qt.ClickFocus )
		self.canvas.setFocus()
		self.canvas.figure.patch.set_facecolor('white')
		#self.canvas.set_size_request(600, 400)
		self.canvas.show()

		self.main_vbox.addWidget(self.canvas)

		#self.canvas.connect('key_press_event', self.on_key_press_event)


		self.setLayout(self.main_vbox)


#	def keyPressEvent(self, event):
#		pritn("oh")
#
#		keyname = ''
#		key = event.key()
#		modifiers = int(event.modifiers())
#		if (Qt.CTRL & modifiers)==modifiers and key==67:
#			self.do_clip()
#			self.canvas.draw()

	def press(self,event):
		#print('press', event.key)
		sys.stdout.flush()
		if event.key == "ctrl+c":
			self.do_clip()


	def do_clip(self):
		buf = io.BytesIO()
		self.my_figure.savefig(buf)
		QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
		buf.close()

	def callback_save_image(self):
		response=save_as_filter(self,"png (*.png);;jpg (*.jpg)")
		if response != None:
			print(response)
			self.my_figure.savefig(response)

	def set_data_file(self,file):
		self.optical_mode_file=os.path.join(os.getcwd(),"light_dump",file)

	def draw_graph(self):
		self.layer_end=[]
		self.layer_name=[]

		n=0
		self.my_figure.clf()
		ax1 = self.my_figure.add_subplot(111)
		ax2 = ax1.twinx()
		x_pos=0.0
		layer=0
		color =['r','g','b','y','o','r','g','b','y','o']
		start=0.0

		for i in range(0,epitaxy_get_layers()):
			if epitaxy_get_electrical_layer(i).startswith("dos")==False:
				start=start-epitaxy_get_width(i)
			else:
				break
		print("START=",start)
		start=start*1e9

		x_pos=start
		for i in range(0,epitaxy_get_layers()):

#			label=epitaxy_get_mat_file(i)
			layer_ticknes=epitaxy_get_width(i)
			layer_material=epitaxy_get_mat_file(i)

			delta=float(layer_ticknes)*1e9
			print(epitaxy_get_electrical_layer(i))
			if epitaxy_get_electrical_layer(i).startswith("dos")==False:
				mat_file=os.path.join(os.getcwd(),'materials',layer_material,'mat.inp')
				myfile = open(mat_file)
				self.mat_file_lines = myfile.readlines()
				myfile.close()

#.........这里部分代码省略.........
开发者ID:roderickmackenzie,项目名称:gpvdm,代码行数:103,代码来源:band_graph.py


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