Hello. Ive got two functions here. Somehow the program does not go in to the second function wehn i call it. The bestfit function. Could some1 help me identify the problem. Heres the code:
import Gnuplot def bestfit(uinput): if not isinstance(uinput, list): return False else: sigmax = sigmay = sigmaxy = sigmaxwhl = sigmaxsq = 0 for i in range(len(uinput)): n = len(uinput) sigmax = uinput[i][0] + sigmax sigmay = uinput[i][1] + sigmay sigmaxy = uinput[i][0] * uinput [i][1] + sigmaxy sigmaxwhl = sigmax * sigmax sigmaxsq = uinput[i][0] * uinput[i][0] + sigmaxsq sigmaxsigmay = sigmax * sigmay num = sigmaxsigmay - (n * sigmaxy) den = sigmaxwhl - (n* sigmaxsq) num2 = (sigmax * sigmaxy) - (sigmay * sigmaxsq) gradient = num / den intercept = num2 / den m = gradient c = intercept p = Gnuplot.Gnuplot() p.plot ('%f * x+%f'%(m,c)) return p def plot(original, expected, actual): if not isinstance(original, list): return False else: gp = Gnuplot.Gnuplot() gp('set data style lines') # Make the plot items plot1 = Gnuplot.PlotItems.Data(original, title="Original") plot2 = Gnuplot.PlotItems.Data(expected, title="Expected") plot3 = Gnuplot.PlotItems.Data(actual, title="Acutal") gp.plot(plot1, plot2, plot3) bestfit(expected) bestfit(actual) return gp ------- import Combine #The name of my file... gp = Combine.plot( [(2,3), (4,8), (5,9), (6,2)], [(1,7), (3,3), (4,5), (5,6)], [(1,3), (3,10), (4,8), (7,9) ] ) raw_input() -- http://mail.python.org/mailman/listinfo/python-list