本文整理汇总了Python中pyqtgraph.PolyLineROI方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.PolyLineROI方法的具体用法?Python pyqtgraph.PolyLineROI怎么用?Python pyqtgraph.PolyLineROI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.PolyLineROI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getArrayRegion
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PolyLineROI [as 别名]
def test_getArrayRegion(transpose=False):
pr = pg.PolyLineROI([[0, 0], [27, 0], [0, 28]], closed=True)
pr.setPos(1, 1)
rois = [
(pg.ROI([1, 1], [27, 28], pen='y'), 'baseroi'),
(pg.RectROI([1, 1], [27, 28], pen='y'), 'rectroi'),
(pg.EllipseROI([1, 1], [27, 28], pen='y'), 'ellipseroi'),
(pr, 'polylineroi'),
]
for roi, name in rois:
# For some ROIs, resize should not be used.
testResize = not isinstance(roi, pg.PolyLineROI)
origMode = pg.getConfigOption('imageAxisOrder')
try:
if transpose:
pg.setConfigOptions(imageAxisOrder='row-major')
check_getArrayRegion(roi, 'roi/'+name, testResize, transpose=True)
else:
pg.setConfigOptions(imageAxisOrder='col-major')
check_getArrayRegion(roi, 'roi/'+name, testResize)
finally:
pg.setConfigOptions(imageAxisOrder=origMode)
示例2: addPolyLine
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PolyLineROI [as 别名]
def addPolyLine(self):
[[xmin, xmax], [ymin, ymax]] = self.plot.viewRange()
self.poly_line = pg.PolyLineROI(
positions=[(xmin+(xmax-xmin)*.4,
ymin+(ymax-ymin)*.4),
(xmin+(xmax-xmin)*.6,
ymin+(ymax-ymin)*.6)],
pen=pg.mkPen('g', width=2))
self.plot.addItem(self.poly_line)
self.updateTransPlot()
self.poly_line.sigRegionChangeFinished.connect(
self.updateTransPlot)
示例3: drawScatterplot
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PolyLineROI [as 别名]
def drawScatterplot(self, xvalues, xmin, xmax, yvalues, ymin, ymax, slope, intercept, ids, symbols=None):
# plot the chart
if has_pyqtgraph:
self.scatter = pg.ScatterPlotItem()
self.plot.clear()
# each point takes the colour of the map
if symbols:
points = []
for i, id in enumerate(ids):
x = xvalues[i]
y = yvalues[i]
symb = symbols[i]
points.append({'pos': (x,y), 'data': id, 'size': 3, 'pen': pg.mkPen(None), 'brush': symb})
self.scatter.addPoints(points)
else:
self.scatter.addPoints(x=xvalues, y=yvalues, data=ids, size=3, pen=pg.mkPen(None), brush=pg.mkBrush(235, 235, 235, 255))
# selection by direct click
self.scatter.sigClicked.connect(self.changedScatterplotSelection)
self.plot.addItem(self.scatter)
# add the regression line
self.regress_line = pg.InfiniteLine()
self.regress_line.setAngle(atan(slope/1) * 180 / 3.1459)
self.regress_line.setValue((0,intercept))
self.regress_line.setPen(color='b', width=1)
if self.show_lines:
self.plot.addItem(self.regress_line)
# newfeature: add the selection tool
#self.roi = pg.PolyLineROI([[xmin, ymin],[xmax, ymin],[xmax, ymax],[xmin, ymax]], closed=True)
#self.roi.sigRegionChangeFinished.connect(self.changedScatterPlotSelection)
#self.plot.addItem(self.roi)
#self.plot.disableAutoRange('xy')
# allow selection of items in chart and selecting them on the map