# Show a Movable Line on a Graph

You can add an unfitted, movable line to any graph that has numeric attributes on both the horizontal and vertical axes (both the X and Y axes).

- Select the graph.
- Click the ruler icon in the right corner of the Graph window.
- Check
**Movable Line**, as shown below. You can then click and drag the line so that it goes through the points on your graph. Note that the equation used to produce the line also appears on the graph in a yellow box (you can drag the box to a new position in the graph if you want to). The equation will change as you drag the line. - If you decide that your line should always pass through the origin (0, 0) on the graph, click on the ruler icon in the inspector panel to the right of the graph, and choose
**Intercept Locked**from the menu, as shown here:

Dragging the line by its middle keeps the slope but changes the intercept (translates the line) (this will not work if the intercept is locked). Dragging by either end changes the slope (rotates the line). The cursor you get when you hover over the line changes to tell you which kind of drag you’re about to perform (arrows pointing straight up and down for translating the line vs. curved arrows for roating the line).

Also, try checking the box for “Squares of Residuals” in the ruler/Measure menu. This will add a visual representation of the squares of residuals to your graph, as well as the exact sum of squares value in the yellow highlighted box on the graph. As you drag/move the line around, the squares of residuals (and the sum of squares value) will change. Try dragging the line to get the best fit to the data points and to minimize the sum of squares, manually performing least squares regression (see 2nd gif below) (least squares regression can also be done automatically in CODAP–see here).

**Note:** To remove a movable line, uncheck Movable Line from the Ruler menu.