write a program that graphically plots a regression line, that is, the line with the best fit through a collection of points.First ask the user to specify the data points by clicking on them in a graphics window. To find the end of input place a small rectangle labeled done in the lower left corner of the window; the program will stop gathering points when the user clicks inside that rectangle.

Please Help this is what I have....
from graphics import*
def main():
#Make Graphics Window
win=GraphWin("",700,700)
win.setCoords(-10,-10,10,10)

#Make the Done Button
done_button=Rectangle(Point(7,-9),Point(10,-10))
done_button.setFill("White")
done_button.draw(win)

done_text=Text(Point(8.5,-9.5),"Done")
done_text.setTextColor("Black")
done_text.draw(win)

p1=win.getMouse()
x=p1.getX()
y=p1.getY()

while x<=7 and y>= -9:
Cir=Circle(p1,.2)
Cir.setFill("Red")
Cir.draw(win)
p1=win.getMouse()
x=p1.getX()
y=p1.getY()


#Calculate xbar, ybar, and slope, y for -10 and y for 10

Recommended Answers

All 2 Replies

What's the actual question you're asking? You just kinda gave a description and plopped your code out. If this is for a school project (which I assume it is), I'll try to help...

Wrap your code in code tags. It will make it readable for us and it won't lose the indentation.

[code=python] # Code here

[/code]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.