您可以通过更改画笔的(r,g,b,a) 元组来调整绘图的透明度。最后一个参数 (a) 确定填充图的 alpha 设置,范围为0-255。将此值设置为 0 将提供 100% 的透明度,而将其设置为 255 将提供 100% 的不透明填充。
对于您的示例,更改此行将影响填充的透明度。将其设置为50 会给你一个半透明的填充
p7.plot(y, fillLevel=-0.3, brush=(50,50,200,50))
将值设置为 200 会提供更不透明的填充
p7.plot(y, fillLevel=-0.3, brush=(50,50,200,200))
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="Basic plotting examples")
win.resize(1000,600)
win.setWindowTitle('pyqtgraph example: Plotting')
# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)
p7 = win.addPlot(title="Filled plot, axis disabled")
y = np.sin(np.linspace(0, 10, 1000)) + np.random.normal(size=1000, scale=0.1)
p7.plot(y, fillLevel=-0.3, brush=(50,50,200,50)) # <-- Adjust the brush alpha value
p7.showAxis('bottom', False)
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()