本文整理汇总了Python中pyqtgraph.GraphicsLayoutWidget.getItem方法的典型用法代码示例。如果您正苦于以下问题:Python GraphicsLayoutWidget.getItem方法的具体用法?Python GraphicsLayoutWidget.getItem怎么用?Python GraphicsLayoutWidget.getItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.GraphicsLayoutWidget
的用法示例。
在下文中一共展示了GraphicsLayoutWidget.getItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWidget
# 需要导入模块: from pyqtgraph import GraphicsLayoutWidget [as 别名]
# 或者: from pyqtgraph.GraphicsLayoutWidget import getItem [as 别名]
#.........这里部分代码省略.........
self.ZMatModel.dataChanged.disconnect(self.clearUpdateView)
filename = self.fileDialog.getOpenFileName(self, 'Open file', expanduser('~'), '*.log;;*.*')
if filename:
self.gaussianPlot.clear()
self.inp = []
self.populateZMatModel()
file = ccopen(filename)
data = file.parse().getattributes()
self.natom = data['natom']
self.atomnos = data['atomnos'].tolist()
self.atomsymbols = [ str(elements[e]) for e in self.atomnos ]
self.atomcoords = data['atomcoords'].tolist()
self.scfenergies = data['scfenergies'].tolist()
self.geovalues = data['geovalues'].T.tolist()
self.geotargets = data['geotargets'].tolist()
if 'vibfreqs' in data.keys():
self.vibfreqs = data['vibfreqs']
#print(self.vibfreqs)
self.vibirs = data['vibirs']
#print(self.vibirs)
#print(data.keys())
if 'vibramans' in data.keys():
self.vibramans = data['vibramans']
else:
self.vibramans = [''] * len(self.vibirs)
self.vibdisps = data['vibdisps']
#print(self.vibdisps)
self.inp = xyz2zmat(self.atomcoords[0], self.atomsymbols)
self.populateZMatModel()
titles = ['SCF Energies', 'RMS & Max Forces', 'RMS & Max Displacements']
for i in range(3):
self.gaussianPlot.addPlot(row=1, col=i+1)
plot = self.gaussianPlot.getItem(1, i+1)
plot.setTitle(title=titles[i])
if i == 0:
c = ['c']
x = [0]
y = [self.scfenergies]
else:
c = ['r', 'y']
x = [0, 0]
y = [self.geovalues[2*i-2], self.geovalues[2*i-1]]
targety = [self.geotargets[2*i-2], self.geotargets[2*i-1]]
plot.clear()
plot.maxData = plot.plot(y[0], symbol='o', symbolPen=c[0], symbolBrush=c[0], pen=c[0], symbolSize=5, pxMode=True, antialias=True, autoDownsample=False)
plot.highlight=plot.plot(x, [ yy[0] for yy in y ], symbol='o', symbolPen='w', symbolBrush=None, pen=None, symbolSize=15, pxMode=True, antialias=True, autoDownsample=False)
plot.maxData.sigPointsClicked.connect(self.gausclicked)
if i > 0:
for j in range(2):
plot.addLine(y=np.log10(targety[j]), pen=mkPen((255, 255*j, 0, int(255/2)), width=1))
plot.RMSData=plot.plot(y[1], symbol='o', symbolPen=c[1], symbolBrush=c[1], pen=c[1], symbolSize=5, pxMode=True, antialias=True, autoDownsample=False)
plot.RMSData.sigPointsClicked.connect(self.gausclicked)
plot.setLogMode(y=True)
self.showGauss()
self.updateView()
self.statusBar.clearMessage()
self.statusBar.showMessage('Read molecule from '+filename+'.', 5000)
self.ZMatModel.dataChanged.connect(self.clearUpdateView)
if self.natom:
self.showGaussAction.setEnabled(True)
if 'vibfreqs' in data.keys():
self.showFreqAction.setEnabled(True)
# populate the FreqModel
self.populateFreqModel()
示例2: ScopeWindow
# 需要导入模块: from pyqtgraph import GraphicsLayoutWidget [as 别名]
# 或者: from pyqtgraph.GraphicsLayoutWidget import getItem [as 别名]
#.........这里部分代码省略.........
self._loaded_array = []
# update index
self.index += index_insert
for a in index_remove:
self.index.remove(a)
# Insert new episodes
for i in index_insert:
self.episodes['Data'][i] = NeuroData(dataFile=self.episodes['Dirs'][i], old=True, infoOnly=False, getTime=True)
self._loaded_array.append(i)
# call self.drawPlot
self.drawEpisode(self.episodes['Data'][i], info=(self.episodes['Name'], self.episodes['Epi'][i]))
# Remove episodes
for j in index_remove:
self.removeEpisode(info=(self.episodes['Name'], self.episodes['Epi'][j]))
def drawEpisode(self, zData, info=None, pen=None):
"""Draw plot from 1 zData"""
# Set up pen color
if self.options['colorfy']:
availableColors = list(colors)
for c in self._usedColors:
availableColors.remove(c)
pen = availableColors[0]
self._usedColors.append(pen)
elif pen is None:
pen = self.options['theme']['pen']
# Loop through all the subplots
for n, l in enumerate(self.options['layout']):
# get viewbox
p = self.graphicsView.getItem(row=l[2], col=l[3])
if p is None:
p = self.graphicsView.addPlot(row=l[2], col=l[3])
# Make sure later viewboxes are linked in time domain
if n>0:
p.setXLink(self.graphicsView.getItem(row=0, col=0))
# put an identifier on the trace
if isinstance(info, tuple):
pname = info[0]+'.'+info[1]+'.'+l[0]+'.'+l[1]
else:
pname = None
p.plot(x=zData.Time, y=getattr(zData, l[0])[l[1]], pen=pen, name=pname)
def removeEpisode(self, info=None):
if not info:
return
for l in self.options['layout']:
# get viewbox
p1 = self.graphicsView.getItem(row=l[2], col=l[3])
pname = info[0]+'.'+info[1]+'.'+l[0]+'.'+l[1]
remove_index = []
for k, a in enumerate(p1.listDataItems()):
if a.name() == pname: # matching
p1.removeItem(a)
remove_index.append(k)
# recover the colors
if remove_index and self.options['colorfy']: