python中pyqtgraph是什么?
发布时间:2024-09-18 16:27:00
PyQtGraph是纯Python,但它的底部是PyQt,也就是Qt的Python封装,底部是C/C++语言开发图书馆是在PyQT的基础上开发的可视化控制器。与旧的绘图图书馆相比,PyQTGraph在绘图速度上尤为突出,在保证绘图美观、功能强大的前提下,可以高效绘制图形。让我们详细了解一下使用技巧。
安装pyqtgraph库:
pipinstall--userpyqtgraph
安装方式更快:
pip3.8install-ihttps://mirrors.aliyun.com/pypi/simple
导入方式:
importpyqtgraphaspg
自带实例模块:
python-mpyqtgraph.examples
绘制折线图:
frompyqtgraph.QtimportQtGui,QtCore
importpyqtgraphaspg
frompyqtgraph.widgets.RemoteGraphicsViewimportRemoteGraphicsView
app=pg.mkQApp()
v=RemoteGraphicsView(debug=False)
v.show()
v.setWindowTitle('单1折线图')
plt=v.pg.PlotItem()
v.setCentralItem(plt)
y1=[1,四、二、六、二、四、二、三、二、二、三
plt.plot(y1,pen='g')
QtGui.QApplication.instance().exec_()效果展示:
当然,我们也可以制作更先进的设置,先掌握基本内容,也可以进一步学习和掌握~
