Getting curve fit results on your graph
March 8th, 2007
If you tried curve fitting last week, you might have noticed that there’s no way to get the results from a curve fit to show up on your graph. I’ve just added a partial solution to this. When you do a curve fit now, a ‘note’ will be added to your graph which will have the results of your curve fit in it. (The partial part is that this note won’t be on the graph when you download or link to it. This will be fixed in the near future.)
In the curve fit blog post, we ended up with data that looked like this:

and a curve fit dialog that looked like this:

If you do a curvefit now, you should end up with a note on your graph that looks like this:

Hover the mouse over the note, and you’ll see that note can be edited, moved around and hidden:

Click and hold on the ‘drag’ button to move the text around. Click on the ‘hide’ button to hide the text (you can show it again by clicking on ‘show result on graph’ in the curve fit dialog).
Clicking on the text or on the ‘edit’ button will open the text for editing. Current, I’ve formatted this text using the Textile markup language, but this will be changing to something a bit more suited to mathematical markup in the near future.
If you start editing, the text will be:
y = \equation\variables.{\var_name=\var_fitvalue+/-\var_fiterror}
Looks kind of complicated, eh?
Here’s what’s happening:
Anything with a ’\’ in front of it will be substituted for something else by Plotomatic. In this case, \equation will be replace with your equation. instead of y=\equation, you’ll see y=Ax**2+B.
The \variables substitution is a bit more complicated. The stuff inside the curly brackets will be repeated for every variable in the curve fit. So, if you had a curvefit with 3 variables,
\variables.{This is a variable}
would be replaced by
This is a variableThis is a variableThis is a variableThe other thing that’s happening is that there are variable dependent substitutions. The table below explains these
| Text | Substitution |
|---|---|
| \var_name | the variable’s name |
| \var_fitvalue | The variable’s value after fitting |
| \var_fiterror | The error on the fit for that variable |
So, the code \variables.{\var_name=\var_fitvalue+/-\var_fiterror}
will be replaced by
A = 0.994414 +/- 0.008155
for the variable A and
B = 1.02976 +/- 0.147
for the variable B
That’s it for now. I’ll talk more about formatting your equation and making it look nice after I’ve got the notes showing up in graphs that you download or link to.

Sorry, comments are closed for this article.