PyQtGraph Basic Realization
2018-12-24 09:07:36来源:博客园 阅读 ()
Profile
The Following Picture is the result of this time's work. It's the first step used to verify the basic function of PyQtGraph.
Download PyQtGraph
It's Always recommanded to download PyqtGraph through pip, As
pip install pyqtgraph
If you want to speed up the download process, you can use the one provided by DouBan, use command as
pip install pyqtgraph -i https://pypi.douban.com/simple
Inherit pyqtgraph.GraphicLayoutWidget in QtDesigner
The basic conception of inheriting modules in QtDesigner would not be mentioned here. Please google/baidu it by your self.
Following picture is the configuration.
After using PyUIC to Create the MainWindow class, you would have found all this widget's setup is updated.
self.Graphics_container = GraphicsLayoutWidget() self.Graphics_container.setGeometry(QtCore.QRect(0, 0, 1200, 450)) self.Graphics_container.setMinimumSize(QtCore.QSize(1200, 0)) self.Graphics_container.setObjectName("Graphics_container")
The GraphicsLayoutWidget would be imported as well
from pyqtgraph import GraphicsLayoutWidget
Add new Graph in the Widget
plt1 = self.Graphics_container.addPlot(row=0,col=0) plt2 = self.Graphics_container.addPlot(row=1,col=0) plt3 = self.Graphics_container.addPlot(row=2,col=0) plt4 = self.Graphics_container.addPlot(row=3,col=0) plt5 = self.Graphics_container.addPlot(row=4,col=0) plt6 = self.Graphics_container.addPlot(row=5,col=0)
Create Pattern of Graph
list1 = [] for i in range(10): list1.extend(np.zeros(20)) list1.extend(np.ones(20))
Call Pattern in the Graph
plt1.plot(list1,pen=pg.mkPen(color='#AA0000', width=1),name="Red Line") plt2.plot(list1,pen=pg.mkPen(color='#AA0000', width=1),name="Green Line") plt3.plot(list1,pen=pg.mkPen(color='#AA0000', width=1),name="Blue Line") plt4.plot(list1,pen=pg.mkPen(color='#AA0000', width=1),name="Green Line") plt5.plot(list1,pen=pg.mkPen(color='#AA0000', width=1),name="Green Line") plt6.plot(list1,pen=pg.mkPen(color='#AA0000', width=1),name="Green Line")
pg is the pyqtGraph, which was imported as pg, through mkpen(**args) we can define the brush used in the Graph, you can use the same way add more Lines in the same plot
These is the first part of my Work, To be Continue
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- PyQtGraph Basic Realization[2] 2018-12-25
- 日志 2018-11-13
- Visual Basic 2012 借助DataGridView控件将Excel 2010数据导 2018-06-17
- Visual Basic 2012 借助DataGridView控件将SQL server2012 2018-06-17
- Decimal Basic 学习笔记(1) 2018-06-17
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash