Python 的 PyQtGraph:是否可以使用渐变填充图?

Python's PyQtGraph: Is it possible to have a gradient-filled plot?

是否可以使用 PyQtGraph 生成看起来像这样的图?我知道如何创建填充图,但我找不到任何将渐变应用于填充区域的示例。

查看 PlotCurveItem 上的画笔和设置填充级别。您可以使用 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_()