PyQtGraph在pyqt中的应用及安装过程


Posted in Python onAugust 04, 2019

1.PyQtGraph简介:

pyqtgraph的主要用途:

1、为数据、绘图、视频等提供快速、可交互图形显示。

2、提供快速开发应用的工具。

2.PyQtGraph的安装:

pip install pyqtgraph

安装完成之后执行如下代码可以看到官方示例。

import pyqtgraph.examplespyqtgraph.examples.run()

官方示例如图:

PyQtGraph在pyqt中的应用及安装过程

 3.设置提升的窗口控件

将QWidget窗口控件拖动到主窗口中,然后对提升的窗口进行设置,如下图所示

PyQtGraph在pyqt中的应用及安装过程

 把QWidget控件重命名为pyqtgraph

然后上代码。。。 

 

def init_plot(self):
    self.p1 = self.pyqtgraphl1.addPlot(title="温度")
    self.curve1 = self.p1.plot(pen='r')
    self.p1_list = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  def update_plot(self):
    # rand = random.randrange(0, 100)
    del self.p1_list[0]
    self.p1_list.append(self.ch0) #添加最新的数据
    self.curve1.setData(self.p1_list) #设置图表的纵坐标数据
    if self.ptr == 0:        #规定吧
      pass
      self.p1.enableAutoRange('xy', False) ## stop auto-scaling after the first data set is plotted
    self.ptr += 1

总结

以上所述是小编给大家介绍的PyQtGraph在pyqt中的应用,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

Python 相关文章推荐
python脚本实现查找webshell的方法
Jul 31 Python
使用Kivy将python程序打包为apk文件
Jul 29 Python
python3 pillow生成简单验证码图片的示例
Sep 19 Python
python使用itchat库实现微信机器人(好友聊天、群聊天)
Jan 04 Python
Python用sndhdr模块识别音频格式详解
Jan 11 Python
python微信公众号之关注公众号自动回复
Oct 25 Python
python3 求约数的实例
Dec 05 Python
python3的UnicodeDecodeError解决方法
Dec 20 Python
python计算二维矩形IOU实例
Jan 18 Python
python3 使用openpyxl将mysql数据写入xlsx的操作
May 15 Python
python 自动化偷懒的四个实用操作
Apr 11 Python
利用Matlab绘制各类特殊图形的实例代码
Jul 16 Python
详解用python生成随机数的几种方法
Aug 04 #Python
python下PyGame的下载与安装过程及遇到问题
Aug 04 #Python
python中pygame安装过程(超级详细)
Aug 04 #Python
浅谈python图片处理Image和skimage的区别
Aug 04 #Python
Python下opencv图像阈值处理的使用笔记
Aug 04 #Python
python opencv 简单阈值算法的实现
Aug 04 #Python
Python pandas用法最全整理
Aug 04 #Python
You might like
逐步提升php框架的性能
2008/01/10 PHP
windows环境下php配置memcache的具体操作步骤
2013/06/09 PHP
destoon网站转移服务器后搜索汉字出现乱码的解决方法
2014/06/21 PHP
php上传图片类及用法示例
2016/05/11 PHP
基于PHPexecl类生成复杂的报表表头示例
2016/10/14 PHP
PHP children()函数讲解
2019/02/03 PHP
YII框架http缓存操作示例
2019/04/29 PHP
关于PhpStorm设置点击编辑文件自动定位源文件的实现方式
2020/12/30 PHP
textarea中的手动换行处理的jquery代码
2011/02/26 Javascript
JavaScript-RegExp对象只能使用一次问题解决方法
2014/06/23 Javascript
JSONP跨域GET请求解决Ajax跨域访问问题
2014/12/31 Javascript
Javascript中实现trim()函数的两种方法
2015/02/04 Javascript
node.js实现端口转发
2016/04/14 Javascript
javascript实现滚动效果的数字时钟实例
2016/07/21 Javascript
livereload工具实现前端可视化开发【推荐】
2016/12/23 Javascript
canvas 绘制圆形时钟
2017/02/22 Javascript
页面点击小红心js实现代码
2018/05/26 Javascript
[01:04:35]2018DOTA2亚洲邀请赛 4.3 突围赛 Secret vs VG 第一场
2018/04/04 DOTA
Python中的ceil()方法使用教程
2015/05/14 Python
Python实现螺旋矩阵的填充算法示例
2017/12/28 Python
python-str,list,set间的转换实例
2018/06/27 Python
python 数字类型和字符串类型的相互转换实例
2018/07/17 Python
在Mac下使用python实现简单的目录树展示方法
2018/11/01 Python
六行python代码的爱心曲线详解
2019/05/17 Python
python实现把二维列表变为一维列表的方法分析
2019/10/08 Python
Python selenium 自动化脚本打包成一个exe文件(推荐)
2020/01/14 Python
python如何停止递归
2020/09/09 Python
python 如何使用find和find_all爬虫、找文本的实现
2020/10/16 Python
Servlet都有哪些方法?主要作用是什么?
2014/03/04 面试题
初一学生评语大全
2014/04/24 职场文书
学校社会实践活动总结
2014/07/03 职场文书
搞笑的获奖感言
2014/08/16 职场文书
2014年国庆节演讲稿
2014/09/02 职场文书
企业安全生产规章制度
2015/08/06 职场文书
windows11怎么查看自己安装的版本号? win11版本号的查看方法
2021/11/21 数码科技
Android开发之WECHAT微信小程序路由跳转的两种形式
2022/04/12 Java/Android