本文整理汇总了Python中pyqtgraph.intColor函数的典型用法代码示例。如果您正苦于以下问题:Python intColor函数的具体用法?Python intColor怎么用?Python intColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了intColor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:jkokorian,项目名称:ODMAnalysis,代码行数:9,代码来源:odmstudio_gui.py
示例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'))
开发者ID:albanatita,项目名称:data-process,代码行数:14,代码来源:processActions.py
示例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))
开发者ID:phonchi,项目名称:chipwhisperer,代码行数:7,代码来源:PartitionDisplay.py
示例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
开发者ID:pbustos,项目名称:beacons,代码行数:35,代码来源:sliding.py
示例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)
开发者ID:albanatita,项目名称:data-process,代码行数:26,代码来源:processActions.py
示例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')
开发者ID:portfors-lab,项目名称:SparkleAnalysis,代码行数:8,代码来源:pyqtgraph_widgets.py
示例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()
开发者ID:EwanLu,项目名称:chipwhisperer,代码行数:56,代码来源:PartitionDisplay.py
示例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_()
开发者ID:Som-Energia,项目名称:somenergia-generationkwh,代码行数:43,代码来源:genkwh_curve.py
示例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
开发者ID:campagnola,项目名称:relativipy,代码行数:12,代码来源:test.py
示例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
开发者ID:ddale,项目名称:pymeasure,代码行数:13,代码来源:widgets.py
示例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
开发者ID:pdroberts,项目名称:sparkle,代码行数:13,代码来源:pyqtgraph_widgets.py
示例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)
开发者ID:UpSea,项目名称:ZipLineMid,代码行数:51,代码来源:test02.py
示例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()
开发者ID:fschill,项目名称:mavue,代码行数:14,代码来源:plot_widget.py
示例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)
开发者ID:brianc118,项目名称:ballbotCommander,代码行数:14,代码来源:ballbotCommander.py
示例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
开发者ID:campagnola,项目名称:relativipy,代码行数:14,代码来源:test3.py
示例16: onViewRangeChanged
def onViewRangeChanged(viewRange, x, y, barGraphItem):
"""Updates barGraphItem data depending on plotItem viewRange.
@param viewRange: PlotItem viewRange
@param x, y: Data of barGraphItem
@param barGraphItem: BarGraphItem which data is to be updated
"""
v = list()
v.append(max(x[0], viewRange[0]))
v.append(min(x[-1], viewRange[-1]))
# n = 1024
newX = np.linspace(v[0], v[1], n)
newY = np.interp(newX, x, y)
# colors must be interpolated either in my task, here I just create new list of random colors
colors = [pg.intColor(np.random.randint(1, 100)) for i in xrange(n)]
barGraphItem.setOpts(x0=newX[:-1], x1=newX[1:], y0=[0] * n, y1=newY, brushes=colors, pens=colors)
开发者ID:acrsilva,项目名称:animated-zZz-machine,代码行数:15,代码来源:pruebabar.py
示例17: setup_plot
def setup_plot(self):
self.plot = self#.plot()
self.showGrid(x=True, y=True)
# don't show the default left & bottom axes
[self.plot.showAxis(o, False) for o in ('left', 'bottom')]
# create & add scatter item to plot
self.scatters = []
for i, ul in enumerate(self.ulabels):
mask = self.labels == ul
brush = pg.intColor(i, hues=len(self.ulabels), alpha=125)
spi = pg.ScatterPlotItem(x=self.x[mask], y=self.y[mask], pen=None, brush=brush)
self.scatters.append(spi)
map(self.plot.addItem, self.scatters)
开发者ID:JulieCB,项目名称:INSPy,代码行数:16,代码来源:select.py
示例18: to_update
def to_update(self,obj=None):
self.spots,self.adj = self.graphModel.to_plot()
self.pos = []
try:
selected = self.selectionModel().selectedRows()
selected = [x.row() for x in selected]
except AttributeError:
selected = []
for i,s in enumerate(self.spots):
if i in selected:
s['pen'] = pg.mkPen('r')
else:
s['pen'] = pg.mkPen('k')
for k,v in s.items():
if k == 'pos':
self.pos.append(v)
elif k == 'symbol':
if v is None:
val = symbols[0]
elif v[0] == 'factor':
if v[1] > len(symbols) - 1:
val = symbols[-1]
else:
val = symbols[v[1]]
else:
val = symbols[0]
s[k] = val
elif k == 'size':
if v is None:
val = s_r[0]
elif v[0] == 'factor':
val = ((s_r[1] - s_r[0]) * (v[1]/v[2])) + s_r[0]
else:
val = ((s_r[1] - s_r[0]) * v[1]) + s_r[0]
s[k] = val
elif k == 'brush':
if v is None:
val = pg.mkBrush('c')
elif v[0] == 'factor':
s[k] = pg.mkBrush(pg.intColor(v[1], hues = v[2]))
else:
s[k] = pg.mkBrush(0,0,((c_r[1] - c_r[0]) * v[1]) + c_r[0])
self.spots[i] = s
self.update_data()
开发者ID:mmcauliffe,项目名称:exemplar-network-explorer,代码行数:44,代码来源:views.py
示例19: makeScatterPlot
def makeScatterPlot():
## 1) All spots identical and transform-invariant (top-left plot).
## In this case we can get a huge performance boost by pre-rendering the spot
## image and just drawing that image repeatedly.
n = 300
s1 = pg.ScatterPlotItem(size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 120))
pos = np.random.normal(size=(2,n), scale=1e-5)
spots = [{'pos': pos[:,i], 'data': 1} for i in range(n)] + [{'pos': [0,0], 'data': 1}]
s1.addPoints(spots)
w1.addItem(s1)
s1.sigClicked.connect(clicked)
## 2) Spots are transform-invariant, but not identical (top-right plot).
## In this case, drawing is as fast as 1), but there is more startup overhead
## and memory usage since each spot generates its own pre-rendered image.
s2 = pg.ScatterPlotItem(size=10, pen=pg.mkPen('w'), pxMode=True)
pos = np.random.normal(size=(2,n), scale=1e-5)
spots = [{'pos': pos[:,i], 'data': 1, 'brush':pg.intColor(i, n), 'symbol': i%5, 'size': 5+i/10.} for i in range(n)]
s2.addPoints(spots)
w2.addItem(s2)
s2.sigClicked.connect(clicked)
## 3) Spots are not transform-invariant, not identical (bottom-left).
## This is the slowest case, since all spots must be completely re-drawn
## every time because their apparent transformation may have changed.
s3 = pg.ScatterPlotItem(pxMode=False) ## Set pxMode=False to allow spots to transform with the view
spots3 = []
for i in range(10):
for j in range(10):
spots3.append({'pos': (1e-6*i, 1e-6*j), 'size': 1e-6, 'pen': {'color': 'w', 'width': 2}, 'brush':pg.intColor(i*10+j, 100)})
s3.addPoints(spots3)
w3.addItem(s3)
s3.sigClicked.connect(clicked)
## Test performance of large scatterplots
s4 = pg.ScatterPlotItem(size=10, pen=pg.mkPen(None), brush=pg.mkBrush(255, 255, 255, 20))
pos = np.random.normal(size=(2,10000), scale=1e-9)
s4.addPoints(x=pos[0], y=pos[1])
w4.addItem(s4)
s4.sigClicked.connect(clicked)
QtGui.QApplication.instance().exec_()
开发者ID:profjrr,项目名称:OETC2014_PythonInClassroom_ProfJRR,代码行数:44,代码来源:Mod2Run3.py
示例20: plot_data
def plot_data(self, X, y):
self.clear_plot()
# get the simple cross validation score
clf = LDA()
scores = cross_validation.cross_val_score(clf, X, y, cv=5)
score = np.mean(scores)
self.ui.titleLabel.setText("Accuracy: %.2f" % score)
# project the data to 3D for visualization
clf = LDA(n_components=3)
X_proj = clf.fit(X, y).transform(X)
labels = sorted(np.unique(y))
for i in labels:
plot = gl.GLScatterPlotItem(
pos=X_proj[y == i], color=pg.glColor(pg.intColor(i)))
self.plotWidget.addItem(plot)
self.plot_items.append(plot)
开发者ID:ixjlyons,项目名称:pygesture,代码行数:19,代码来源:tabs.py
注:本文中的pyqtgraph.intColor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论