本文整理汇总了Python中pyqtgraph.LegendItem方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.LegendItem方法的具体用法?Python pyqtgraph.LegendItem怎么用?Python pyqtgraph.LegendItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.LegendItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LegendItem [as 别名]
def __init__(self, parent_plot):
KiteSubplot.__init__(self, parent_plot)
self.aps_correlation = pg.ScatterPlotItem(
antialias=True,
brush=brush_aps,
pen=pen_aps,
size=4)
self.aps_model = pg.PlotDataItem(
antialias=True,
pen=pen_aps_model)
self.legend = pg.LegendItem(offset=(0., .5))
self.legend.setParentItem(self.plot.graphicsItem())
self.legend.addItem(self.aps_model, '')
self.addItem(self.aps_correlation)
self.addItem(self.aps_model)
self.plot.setLabels(
bottom='Elevation (m)',
left='Displacement (m)')
示例2: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LegendItem [as 别名]
def __init__(self, parent_plot):
KiteSubplot.__init__(self, parent_plot)
self.power = pg.PlotDataItem(antialias=True)
# self.power_lin = pg.PlotDataItem(antialias=True, pen=pen_green_dash)
self.power.setZValue(10)
self.plot.setLabels(
bottom='Wavenumber (cycles/m)',
left='Power (m<sup>2</sup>)')
self.plot.setLogMode(x=True, y=True)
# self.legend = pg.LegendItem(offset=(0., .5))
# self.legend.setParentItem(self.plot.graphicsItem())
# self.legend.addItem(self.power_lin, 'Log-linear model')
self.addItem(self.power)
# self.addItem(self.power_lin)
示例3: _add_legend
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LegendItem [as 别名]
def _add_legend(self):
legend = pg.LegendItem((140, 100), offset=(10, 10))
legend.setParentItem(self.chart.getPlotItem())
for arr, item in self.curves:
legend.addItem(
SampleLegendItem(item),
item.opts['name']
if not isinstance(item, tuple)
else item[0].opts['name'],
)
示例4: plot_frame
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LegendItem [as 别名]
def plot_frame(self):
if self.loaded:
self.titles[0].setText('difference')
self.titles[1].setText('merged')
self.titles[2].setText('top')
iPC = int(self.PCedit.text()) - 1
pc1 = self.PC[1,iPC,:,:]
pc0 = self.PC[0,iPC,:,:]
self.img0.setImage(np.tile(pc1[:,:,np.newaxis]-pc0[:,:,np.newaxis],(1,1,3)))
self.img0.setLevels([(pc1-pc0).min(),(pc1-pc0).max()])
rgb = np.zeros((self.PC.shape[2], self.PC.shape[3],3), np.float32)
rgb[:,:,0] = (pc1-pc1.min())/(pc1.max()-pc1.min())*255
rgb[:,:,1] = np.minimum(1, np.maximum(0,(pc0-pc1.min())/(pc1.max()-pc1.min())))*255
rgb[:,:,2] = (pc1-pc1.min())/(pc1.max()-pc1.min())*255
self.img1.setImage(rgb)
if self.cframe==0:
self.img2.setImage(np.tile(pc0[:,:,np.newaxis],(1,1,3)))
else:
self.img2.setImage(np.tile(pc1[:,:,np.newaxis],(1,1,3)))
self.img2.setLevels([pc0.min(),pc0.max()])
self.zoom_plot()
self.p3.clear()
p = [(200,200,255),(255,100,100),(100,50,200)]
ptitle = ['rigid','nonrigid','nonrigid max']
if not hasattr(self,'leg'):
self.leg = pg.LegendItem((100,60),offset=(350,30))
self.leg.setParentItem(self.p3)
drawLeg = True
else:
drawLeg = False
for j in range(3):
cj = self.p3.plot(np.arange(1,self.nPCs+1),self.DX[:,j],pen=p[j])
if drawLeg:
self.leg.addItem(cj,ptitle[j])
self.nums[j].setText('%s: %1.3f'%(ptitle[j],self.DX[iPC,j]))
self.scatter = pg.ScatterPlotItem()
self.p3.addItem(self.scatter)
self.scatter.setData([iPC+1,iPC+1,iPC+1],self.DX[iPC,:].tolist(),
size=10,brush=pg.mkBrush(255,255,255))
self.p3.setLabel('left', 'pixel shift')
self.p3.setLabel('bottom', 'PC #')
self.p4.clear()
self.p4.plot(self.tPC[:,iPC])
self.p4.setLabel('left', 'magnitude')
self.p4.setLabel('bottom', 'time')
self.show()
self.zoom_plot()