Default is all, indicating full connection. pairs causes only
even-numbered segments to be drawn. finite causes segments to be
omitted if they are attached to nan or inf values. For any other
connectivity, specify an array of boolean values.
这里有一个例子
import numpy as np
import pyqtgraph as pg
from PyQt4 import QtCore
a = np.array([1, 2, 3, np.nan, 5, 6, 7, np.nan, 9, 10, 11])
b = np.array([1, 2, 3, np.nan, 3, 2, 1, np.nan, 1, 2, 3])
c = b+3
w = pg.PlotWindow()
finitecurve = pg.PlotDataItem(a, b, connect="finite", pen=(255, 255, 0))
normalcurve = pg.PlotDataItem(a, c, pen=(255, 0, 0))
w.addItem(normalcurve)
w.addItem(finitecurve)
w.show()
if __name__ == '__main__':
import sys
if sys.flags.interactive != 1 or not hasattr(QtCore, 'PYQT_VERSION'):
pg.QtGui.QApplication.exec_()
使用
yourcurve.setData(x, y, connect="finite")
Set data
在plotcurveitem/plotdataitem has the keyword connect中,这正是您要查找的。在从文档中引用有关connect关键字的信息:
这里有一个例子
相关问题 更多 >
编程相关推荐