答案 0 :(得分:2)
查看PlotCurveItem上的brush和setfilllevel。您可以使用PyQt中的渐变设置画笔。
from PyQt4 import QtCore, QtGui
import pyqtgraph as pg
import numpy as np
win = pg.GraphicsWindow()
grad = QtGui.QLinearGradient(0, 0, 0, 3)
grad.setColorAt(0.1, pg.mkColor('#000000'))
grad.setColorAt(0.9, pg.mkColor('b'))
brush = QtGui.QBrush(grad)
p = win.addPlot(y=3+np.random.normal(size=50), brush=brush, fillLevel=0)
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()