python中pyqtgraph是什么 python中pyqtgraph知识点总结

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

python中pyqtgraph是什么 python中pyqtgraph知识点总结

十一   2021-01-26 我要评论

PyQtGraph是纯Python的,只是它底层调用的是PyQt,也就是Qt的Python封装,底层用C/C++语言开发的库,它是在PyQt的基础上开发的可视化控件,相较于老牌的绘制库,PyQtGraph在绘图速度上特别突出,保证绘图的美观性以及强大功能前提下,能够极高的效率去绘制图形,下面一起来详细了解下使用技巧吧。

pyqtgraph库安装:

pip install --user pyqtgraph

更快安装方式:

pip3.8 install -i https://mirrors.aliyun.com/pypi/simple

导入方式:

import pyqtgraph as pg

自带实例模块:

python -m pyqtgraph.examples

绘制折线图:

from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
from pyqtgraph.widgets.RemoteGraphicsView import RemoteGraphicsView
app = pg.mkQApp()
v = RemoteGraphicsView(debug=False)
v.show()
v.setWindowTitle('单1的折线图')
plt = v.pg.PlotItem()
v.setCentralItem(plt)
y1=[1,4,2,3,6,2,3,4,2,3]
plt.plot(y1, pen='g')
QtGui.QApplication.instance().exec_()

效果展示:

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们