I want to draw a line through some of my data points and get the equation in Grapher. Can I?

Yes! Grapher does have ability to create a fit curve, limited to an X range of data, and get the equation for this range. Below are the steps you would need to create the plot, add the fit curve, and get the equation.
  1. Click the Graphs | Create | Basic | Scatter Plot (Grapher 12 scatter plot) command.
  2. In the Open Worksheet dialog, select the data file and click Open.

Your scatter plot will look something like this.

  1. Click on the Line/Scatter Plot 1 object in the Object Manager.
  2. In the Property Manager, click on the Plot tab.
  3. Click the Add/Edit button next to the Fits command.
  4. In the Fits dialog,
    1. In the Available Fits section, select Linear, Y=B*X+A.
    2. Click Add.
    3. Click OK.

You now have a fit curve added to the graph.  But, this default fit curve uses all of the data points to create the equation of the line. 

  1. Click on the Fit 1: Linear object in the Object Manager.
  2. In the Property Manager, click on the Plot tab.
  3. Click the  next to Data limits to open the Data limits section.
  4. Uncheck the box next to the Use curve limits option.
  5. Update the Minimum value and Maximum value. Both of these values are X values. You will want to give the program the range of the data you would like to use. For example, if you want to limit the equation to the red area on this graph, type in 40900 for Minimum value and 40950 for the Maximum value.

The desired points to draw a line through. The drop lines displayed are shown to see the desired interval for the X values.

  1. If you need to determine what the X range is based on the circled area, the simplest way to do this would be to use the Graphs | Digitize | Digitize command. To do so:
    1. Click on the Line/Scatter Plot 1.
    2. Click the Graphs | Digitize | Digitize command.
    3. In the plot window, click on the first symbol of interest.
    4. Click on the last symbol of interest.
    5. In the Grapher – Report window, the X, Y values will be displayed.
    6. To exit digitizing mode, click the Graphs | Digitize | Digitize command or press ESC on your keyboard.
    7. Type in the X values for the Minimum value and the Maximum value.
  1. After changing the fit curve Data limits properties, your fit curve will be reduced to the area highlighted by the red ellipse.

The fit curve is displayed through the desired data points.

  1. If you want the curve to extend the full length of the graph, but be based on only the selected data points:
    1. Click on the Fit 1: Linear.
    2. In the Property Manager,click on the Plot tab.
    3. Click the next to the Plot interval to open the Plot interval section.
    4. Next to the Plot limits option, click Fitted data limits and select Axis limits from the list. The curve extends to the entire X axis range.
    5. Alternatively, you can change the Plot Limits to Custom and type the First X and Last X values. The fit curve will then be extended to these X values.
  1. Finally, to get the equation of the line:
    1. Click the Fit 1: Linear plot.
    2. In the Property Manager, click on the Plot tab. 
    3. Click the next to Statistics to open the Statistics section.
    4. Click the button next to the Clipboard, Report, or Insert statistics commands. Clicking on the Copy button next to the Clipboard command copies the information to the Windows clipboard for pasting into other programs. Clicking on the Display button next to the Report command opens a small text window in Grapher with the fit curve information. Clicking on the Insert button next to the Insert statistics command allows you to click on the Grapher plot window and have the fit curve information displayed next to the graph in an editable text object.

The fit results are displayed using the Insert button.


Updated July 7, 2016

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.