forked from IPKM/nmreval
plot fit and residual together with bigger fit
This commit is contained in:
@ -33,6 +33,12 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.graph_opts = {}
|
||||
self.last_idx = None
|
||||
|
||||
self.resid_plot = self.graphicsView.addPlot(row=0, col=0, title='Residual')
|
||||
self.fit_plot = self.graphicsView.addPlot(row=1, col=0, title='Fit')
|
||||
|
||||
self.graphicsView.ci.layout.setRowStretchFactor(0, 1)
|
||||
self.graphicsView.ci.layout.setRowStretchFactor(1, 2)
|
||||
|
||||
self.resid_graph = PlotItem(x=[], y=[],
|
||||
symbol='o', symbolPen=None, symbolBrush=mkBrush(color=(31, 119, 180)),
|
||||
pen=None)
|
||||
@ -41,7 +47,6 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
||||
pen=None)
|
||||
self.resid_plot.addItem(self.resid_graph)
|
||||
self.resid_plot.addItem(self.resid_graph_imag)
|
||||
self.resid_plot.setLabel('left', 'Residual')
|
||||
|
||||
self.data_graph = PlotItem(x=[], y=[],
|
||||
symbol='o', symbolPen=None, symbolBrush=mkBrush(color=(31, 119, 180)),
|
||||
@ -51,7 +56,6 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
||||
pen=None)
|
||||
self.fit_plot.addItem(self.data_graph)
|
||||
self.fit_plot.addItem(self.data_graph_imag)
|
||||
self.fit_plot.setLabel('left', 'Function')
|
||||
|
||||
self.fit_graph = PlotItem(x=[], y=[])
|
||||
self.fit_graph_imag = PlotItem(x=[], y=[])
|
||||
@ -159,7 +163,7 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
||||
iscomplex = res.iscomplex
|
||||
|
||||
sub_funcs = res.sub(res.x)
|
||||
for item in self.fit_plot.plotItem.items[::-1]:
|
||||
for item in self.fit_plot.items[::-1]:
|
||||
if item not in [self.data_graph, self.data_graph_imag, self.fit_graph, self.fit_graph_imag]:
|
||||
self.fit_plot.removeItem(item)
|
||||
|
||||
|
Reference in New Issue
Block a user