plot
设置plot的pen属性的几种方法,通过画笔可以设置绘制图像的颜色、线宽等参数:
- pen=(255,0,0)
- pen=pg.mkPen(color=‘b’, width=5)
- pen=pg.mkPen({‘color’:‘FF0’, ‘width’: 2})
import sys import os from PyQt5.QtGui import * fromjavascript PyQTfZHtbUt5.QtCore import * from PyQt5.QtWidgets import * import pyqtgraph as pg import numpy as np pg.systemInfo() data = np.random.normal(size=10000) f1 = pg.plot(title='波形图1', y=data, pen=(255,0,0)) f1.setBackground('w') f2 = pg.plot(title='波形图2', y=np.random.normal(size=50), pen=pg.mkPen(color='b', width=5)) f2.setBackground('g') f3 = pg.plot(title='波形图3', y=np.random.normal(size=500),pen=pg.mkPen({'color':'FF0', 'width': 2})) f3.setBackground('b') if __name__ == "__main__": pg.QtGui.QGuiApplication.exec_()
每个plot绘制的波形图都是一个独立的应用程序窗口:
设置symbolBrush,symbolPen属性:
import sys import numpy as np import pyqtgraph as pg pg.plot(np.random.normal(size=100), pen=(255, 255, 0), symbolBrush=(0, 255, 0), symbolPen=(255, 0, 0)) if __name__ == "__maiphpn__": pg.QtGui.QGuiApplication.exec_()
image
import sys import numpy as np import pyqtgraph as pg pg.image(np.random.normal(size=(500, 500))) if __name__ == "__main__": pg.QtGui.QGuiApplication.exec_()
到此这篇关于python绘图库之pyqtgraph的用法详解的文章就介绍到这了,更多相关Python绘图库http://www.devze.compyqtgraph内容请搜索我们以TfZHtbU前的文章或继续浏览下面的相关文章希望开发者_开发培训大家以后多多支持我们!
精彩评论