本文整理汇总了Python中pyqtgraph.intColor函数的典型用法代码示例。如果您正苦于以下问题:Python intColor函数的具体用法?Python intColor怎么用?Python intColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了intColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createPlotRegion
def createPlotRegion(self):
self.linearRegionItem = pg.LinearRegionItem(brush=pg.intColor(1,alpha=100))
self.linearRegionItem.setZValue(10)
self.regionLabel = pg.TextItem(self.trackableFeature.name, color=pg.intColor(1), anchor=(0,1))
self.regionLabel.setX(self.linearRegionItem.getRegion()[0])
self.plotWidget.addItem(self.regionLabel)
self.plotWidget.addItem(self.linearRegionItem, ignoreBounds=True)
self.linearRegionItem.sigRegionChanged.connect(self.linearRegionItem_RegionChanged)
self.regionObserver.bind(self.linearRegionItem,self.linearRegionItem.setRegion,self._linearRegionItem_regionChanged)
示例2: matchFreq
def matchFreq(self):
freq1,freq2,ok=matchDialog.getData()
pencil1=pg.mkPen(color=pg.intColor(1))
pencil2=pg.mkPen(color=pg.intColor(20))
pencil3=pg.mkPen(color=pg.intColor(30))
for k in range(1,4):
self.p3.plot([k*freq1,k*freq1],[0,1.],pen=pencil1)
self.p3.plot([k*freq2,k*freq2],[0,1.],pen=pencil2)
for l in range(1,3):
self.p3.plot([k*freq2-l*freq1,k*freq2-l*freq1],[0,.5],pen=pencil3)
self.p3.plot([k*freq2+l*freq1,k*freq2+l*freq1],[0,.5],pen=pencil3)
self.p3.addItem(pg.PlotDataItem(pen=pencil1,name='ICRF'))
self.p3.addItem(pg.PlotDataItem(pen=pencil2,name='Helicon'))
self.p3.addItem(pg.PlotDataItem(pen=pencil3,name='Beat'))
示例3: redrawPlot
def redrawPlot(self):
self.graph.clearPushed()
for bnum in range(0, self.numKeys):
if self.enabledbytes[bnum]:
self.graph.setColorInt(bnum, self.numKeys)
self.graph.passTrace(self.SADList[bnum], pen=pg.mkPen(pg.intColor(bnum, 16)), idString = str(bnum))
示例4: updateBluetooth
def updateBluetooth(self):
returnedList = blescan.parse_events(self.sock, 1)
for beacon in returnedList:
words = beacon.split(',')
mac = words[0]
uid = words[1]
major = words[2]
minor = words[3]
power = words[4]
rssi = words[5]
print mac, rssi, minor
#print "dict lenght" ,len(self.signalList)
if mac not in self.signalList:
#self.signalList[mac] = np.zeros(self.bufferLength,'f')
self.signalList[mac] = np.zeros(0,'f')
self.curveList[mac] = self.p.plot(pen=QtGui.QPen(pg.intColor(self.nextColor)))
self.nextColor += 1
s = self.signalList[mac]
val = 100 + float(rssi)
if s.size < self.bufferLength:
s = np.append(s,val)
# if s.size > 4:
# s[-1] = self.runningMeanFast(s,3)[0]
print "append" , val
else:
s = np.roll(s,-1)
s[-1] = val
# s[-1] = self.runningMeanFast(s,3)[0]
self.curveList[mac].setData(s)
self.signalList[mac] = s
self.timeElapsed()
self.app.processEvents() ## force complete redraw for every plot
示例5: plotSignal
def plotSignal(self,item):
indexColor=0
self.p1.clear()
self.p2.clear()
for fileName in self.fileName:
print fileName
self.Back=False
self.signalName=item
time,data,self.sampling=readHdf5.getData(fileName,item,self.env)
self.time=np.array(time)
self.data=np.array(data)
self.frqlabel.setText('sampling rate: '+str(self.sampling))
pencil=pg.mkPen(color=pg.intColor(indexColor))
self.p1.plot(self.time,self.data,pen=pencil)
self.p2.plot(self.time,self.data,pen=pencil)
indexColor=indexColor+1
if self.existingData:
self.lr=pg.LinearRegionItem([self.left,self.right])
else:
self.lr=pg.LinearRegionItem([self.time[0],self.time[-1]])
self.left=self.time[0]
self.right=self.time[-1]
self.lr.setZValue(-10)
self.p1.addItem(self.lr)
self.lr.sigRegionChanged.connect(self.updatePlot)
示例6: addTracesABR
def addTracesABR(self, x, ys, intensity, trace_num):
self.clearTraces()
nreps = ys.shape[0]
for irep in reversed(range(nreps)):
self.trace_stash.append(self.plot(x, ys[irep, :], pen=(irep, nreps)))
line = self.plot(pen=pg.intColor(irep, hues=nreps))
self.legend.addItem(line, 'trace_' + str(trace_num[irep]) + ': ' + str(intensity[irep]) + ' dB')
self.legend_names.append('trace_' + str(trace_num[irep]) + ': ' + str(intensity[irep]) + ' dB')
示例7: displayPartitions
def displayPartitions(self, differences={"partclass":None, "diffs":None}, traces=None, tRange=(0, -1)):
if traces is None:
traces = self.traceManager()
if tRange[1] < 0:
tRange = (tRange[0], traces.numTrace() + 1 + tRange[1])
self.partObject.setPartMethod(differences["partclass"])
self.numKeys = len(self.partObject.partMethod.getPartitionNum(traces, 0))
self.SADList = differences["diffs"]
self.graph = self.parent.getGraphWidgets(["Partition Differences"])[0]
# Place byte selection option on graph
if hasattr(self, 'enabledbytes') and len(self.enabledbytes) == self.numKeys:
pass
else:
self.enabledbytes = [False] * self.numKeys
self.doRedraw = True
self.byteNumAct = []
for i in range(0, self.numKeys):
ql = QToolButton()
ql.setText('%d' % i)
color = pg.intColor(i, self.numKeys)
ql.setStyleSheet("color: rgb(%d, %d, %d)" % (color.red(), color.green(), color.blue()))
qa = QWidgetAction(self)
qa.setDefaultWidget(ql)
qa.setStatusTip('%d' % i)
ql.setCheckable(True)
ql.setChecked(self.enabledbytes[i])
ql.clicked[bool].connect(partial(self.setBytePlot, i))
self.byteNumAct.append(qa)
byteNumAllOn = QAction('All On', self)
byteNumAllOff = QAction('All Off', self)
byteNumAllOn.triggered.connect(partial(self.setByteAll, True))
byteNumAllOff.triggered.connect(partial(self.setByteAll, False))
bselection = QToolBar()
for i in range(0, self.numKeys):
bselection.addAction(self.byteNumAct[i])
bselection.addAction(byteNumAllOn)
bselection.addAction(byteNumAllOff)
self.graph.addWidget(bselection)
self.graph.setPersistance(True)
# self.poi.setDifferences(SADList)
# self.parent.findParam('poi-pointrng').setLimits((0, len(SADList[0])))
# self.parent.findParam('poi-pointrng').setValue((0, len(SADList[0])))
self.redrawPlot()
示例8: doPlot
def doPlot(columns, first, last):
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
import pyqtgraph.exporters
import itertools
pg.setConfigOptions(
antialias=True,
background='w',
foreground='k',
)
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="Curve plotter")
win.setWindowTitle('Curve plotter')
plot = win.addPlot(title="Rights and Usage")
ndays=(last-first).days+1
timeAxis = plot.getAxis('bottom')
timeAxis.setTicks([[
(i*25, first+datetime.timedelta(days=i))
for i in xrange(ndays)
],[
(i, i%25)
for i in xrange(25*ndays)
]])
timeAxis.setStyle(
tickTextHeight=390,
)
timeAxis.setGrid(100)
plot.addLegend()
for i,column in enumerate(columns):
plot.plot(np.array(column[1:]),
pen=pg.intColor(i),
name=column[0],
symbol='o',
symbolBrush=pg.intColor(i),
)
win.show()
app.exec_()
示例9: __init__
def __init__(self, x0=0.0, v0=0.0, t0=0.0, prog=None, pen=None, brush=None):
if pen is None:
pen = pg.intColor(Clock.nClocks, 12)
if brush is None:
brush = (0,0,150)
Clock.nClocks += 1
self.x0 = x0
self.v0 = v0
self.t0 = t0
self.prog = prog
self.pen = pen
self.brush = brush
示例10: new_curve
def new_curve(self, results, color=pg.intColor(0), **kwargs):
if 'pen' not in kwargs:
kwargs['pen'] = pg.mkPen(color=color, width=2)
if 'antialias' not in kwargs:
kwargs['antialias'] = False
curve = ResultsCurve(results,
x=self.plot_frame.x_axis,
y=self.plot_frame.y_axis,
**kwargs
)
curve.setSymbol(None)
curve.setSymbolBrush(None)
return curve
示例11: __init__
def __init__(self, groups, xlims=None, parent=None):
super(ProgressWidget, self).__init__(parent)
self.lines = []
self.legend = self.addLegend()
for iline in range(len(groups)):
# give each line a different color
line = self.plot(pen=pg.intColor(iline, hues=len(groups)))
self.lines.append(line)
self.legend.addItem(line, str(groups[iline]))
if xlims is not None:
self.setXlim((xlims[0], xlims[1]))
self.groups = groups
示例12: __init__
def __init__(self, dataForCandle=None):
super(pgCandleWidget, self).__init__()
# 0) adds candle
self.candleData = dataForCandle
self.item01 = CandlestickItem(dataForCandle)
#self.addItem(self.item01)
# 1)cross hair
self.vLine = pg.InfiniteLine(angle=90, movable=False)
self.hLine = pg.InfiniteLine(angle=0, movable=False)
self.addItem(self.vLine, ignoreBounds=True)
self.addItem(self.hLine, ignoreBounds=True)
# 2) adds textInfo
self.textInfo = pg.TextItem("test")
self.addItem(self.textInfo, ignoreBounds=True)
#vb = self.plotItem.vb
#vb.setAspectLocked(True)
n = 300
self.lastClicked = []
def clicked(plot, points):
for p in self.lastClicked:
p.resetPen()
print("clicked points", points)
for p in points:
p.setPen('b', width=2)
self.lastClicked = points
self.item02 = pg.ScatterPlotItem(size=10, pen=pg.mkPen('w'), pxMode=False)
pos = np.random.normal(size=(2,n), scale=1e-5)
spots3 = []
for i in range(10):
for j in range(10):
spots3.append({'pos': (1e-6*i, 1e-6*j), 'size': 1, 'pen': {'color': 'w', 'width': 2}, 'brush':pg.intColor(i*10+j, 100)})
n=5
spots = [{'pos': pos[:,i], 'brush':pg.intColor(i, n), 'symbol': i%5, 'size': 50+i/10.} for i in range(n)]
a1 = {'pos': (10, 20), 'data': 5,'size': 5, 'pen': {'color': 'w', 'width': 2}, 'symbol': 't', 'brush':pg.intColor(10, 100)}
a2 = {'pos': (15, 20), 'data': 5,'size': 5, 'pen': {'color': 'w', 'width': 2}, 'symbol': 'd', 'brush':pg.intColor(10, 100)}
a3 = {'pos': (20, 20), 'data': 5,'size': 5, 'pen': {'color': 'w', 'width': 2}, 'symbol': '+', 'brush':pg.intColor(10, 100)}
spots2 = []
spots2.append(a1)
spots2.append(a2)
spots2.append(a3)
self.item02.addPoints(spots2)
self.addItem(self.item02)
self.item02.sigClicked.connect(clicked)
self.proxy = pg.SignalProxy(self.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved)
示例13: addSource
def addSource(self, sourceX=None, sourceY=None):
if (sourceX is not None and not (isinstance(sourceX.content(), int) or isinstance(sourceX.content(), float))) or \
(sourceY is not None and not (isinstance(sourceY.content(), int) or isinstance(sourceY.content(), float))):
print "cannot add this type as source"
return
sourceTarget=Curve2DBox("data", self, dataRange=[0,0], color=pg.intColor(len(self.targets)))
#if sourceX is not None:
# sourceTarget.sources[0].updateSource(sourceX)
if sourceY is not None:
sourceTarget.sources[1].updateSource(sourceY)
self.targets.append(sourceTarget)
self.targets_layout.addWidget(sourceTarget)
self.rebuildLegend()
示例14: receiveNewNames
def receiveNewNames(self, newNames):
# print("Receiving new names")
self.names = newNames
self.dataColumns = len(self.names)
for i in range(self.dataColumns):
color = pg.intColor(i, self.dataColumns)
self.curveColors.append(color)
item = QtGui.QStandardItem(self.names[i])
item.setBackground(color)
item.setCheckState(Qt.Checked)
item.setCheckable(True)
self.listViewModel.appendRow(item)
self.nameCheckItems.append(item)
示例15: __init__
def __init__(self, x0=0.0, y0=0.0, m0=1.0, v0=0.0, t0=0.0, pen=None, brush=None, prog=None):
if pen is None:
pen = pg.intColor(Clock.nClocks, 12)
if brush is None:
brush = (0,0,150)
Clock.nClocks += 1
self.pen = pg.mkPen(pen)
self.brush = pg.mkBrush(brush)
self.y0 = y0
self.x0 = x0
self.v0 = v0
self.m0 = m0
self.t0 = t0
self.prog = prog