【发布时间】:2021-03-07 02:36:43
【问题描述】:
考虑以下代码:
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
pg.setConfigOptions(antialias=True)
yPoints = np.array([4.2315e-12, 5.0400e-12, 4.7119e-12, 5.0892e-12,])
xPoints = np.array([1, 2, 3, 4])
errors = np.array([2.9131e-13, 3.452e-13, 3.3071e-13, 3.762e-13 + 3e-13])
plt = pg.plot()
errorBarItem = pg.ErrorBarItem(x=xPoints, y=yPoints, top=errors, bottom=errors, beam=0.2)
plt.addItem(errorBarItem)
plt.plot(xPoints, yPoints, symbol='o', pen={'color': 0.8, 'width': 2})
## 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_()
哪些情节:
连接水平误差线的垂直线似乎没有画在一定范围以下(?)。
有没有办法强制 ErrorBarItem 总是画出那条垂直线?怎么走呢?
【问题讨论】:
标签: python python-3.x plot pyqtgraph errorbar