Get 4 points. Your score is MATH_SCORE + GUI_SCORE - ABS(MATH_SCORE-GUI_SCORE)/2 MATH - Add a sin wave curve to the app, complete with item in menu bar to activate it. - Show the pierson's coeffecient betweeen the X and Y data. - Have a menu item so the user can log scale the data and then fit. - Fix my bug. Use a data file who's X's dont start at zero to see. - (3x) When you load the data, have it programatically figure out the best fit, and start with that as the default fit. - (2x) Highlight the biggest outlier point (the point that is farthest from the fit curve. GUI - (2x) Add a save menu item, that saves the current name of the loaded file and the current fit type. Be able to load you save file type. - Set the title of the graph from user input. - Turn on grid lines - Set the X and Y axis labels from user input. - Have a toggle so it can show all the fits at once. - Change the app name (main window name) to reflect the current fata file. - Have a menu of colors .. change the color of the graph. import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import * import numpy as np from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure import matplotlib.pyplot as plt from lmfit import Model class App(QMainWindow): def __init__(self): super().__init__() self.left = 100 self.top = 100 self.title = 'PyQt5 matplotlib example - pythonspot.com' self.width = 640 self.height = 400 menubar = self.menuBar() loadAct = QAction(QIcon('exit24.png'), 'Load', self) loadAct.setShortcut('Ctrl+L') loadAct.triggered.connect(self.load) menubar.addAction(loadAct) fitAct = QAction(QIcon('exit24.png'), 'Line', self) fitAct.triggered.connect(lambda : self.fit(2)) menubar.addAction(fitAct) fitAct = QAction(QIcon('exit24.png'), ' Gauss', self) fitAct.triggered.connect(lambda: self.fit(1)) menubar.addAction(fitAct) fitAct = QAction(QIcon('exit24.png'), ' Poly3', self) fitAct.triggered.connect(lambda: self.fit(3)) menubar.addAction(fitAct) self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.show() def load(self): print("start") options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog self.fileName, _ = QFileDialog.getOpenFileName(self, "QFileDialog.getOpenFileName()", "", "All Files (*);;Text Files (*.txt)", options=options) if self.fileName: self.data = np.genfromtxt(self.fileName, delimiter=",") print(self.data) self.fit() def fit(self, type=1): self.plot = PlotCanvas(parent=self, data=self.data, type=type) self.setCentralWidget(self.plot) self.show() class PlotCanvas(FigureCanvas): def __init__(self, data=None, type=1, parent=None,width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self,QSizePolicy.Expanding,QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) print("About to make funcs") if type==1: def func(x, p1,p2,p3): "1-d gaussian: gaussian(x, amp, cen, wid)" return (p1 / (np.sqrt(2 * np.pi) * p2)) * np.exp(-(x - p3) ** 2 / (2 * p2 ** 2)) elif type==2: def func(x,p1,p2,p3): "Straight line" return p1*x+p2 else: def func(x,p1,p2,p3): "poly" return p1*x*x + p2*x + p3 print("after making gauss") print(data) x = data[:, 0] y = data[:, 1] print(x) gmodel = Model(func) result = gmodel.fit(y, x=x, p1=1, p2=1, p3=1) print(result.best_fit) ax = self.figure.add_subplot(111) ax.plot(data[:,0],data[:,1],'o') ax.plot(result.best_fit,"r") self.draw() if __name__ == '__main__': app = QApplication(sys.argv) ex = App() sys.exit(app.exec_())