0

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

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by jlm699
0

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...

0

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]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.