python中pyqtgraph知識點總結
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, QtCoreimport pyqtgraph as pgfrom pyqtgraph.widgets.RemoteGraphicsView import RemoteGraphicsViewapp = 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_()
效果展示:
到此這篇關于python中pyqtgraph知識點總結的文章就介紹到這了,更多相關python中pyqtgraph是什么內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!
相關文章: