0

I read from the second answer in this thread how to display the line of fit equation on a gnuplot for a linear line of fit. When I try to export that solution to my situation, which is an exponential line of fit, the equation does not display.

My line of code is:

plot "rate.out" t "$target hole density" w lines, f(x) t sprintf('f(x) = %.2f(1-exp(-x/%.2f))', a, tau)

The first part of the code is fine; the segment beginning with sprintf does not seem to be correct.

The line of fit is:

f(x) = a*(1-exp(-x/tau))
  • Is there a way to display the equation of my line on the graph?
  • Incidentally, can I display it as f(t)? I tried writing my line of fit using f(t), but the fit algorithm returns an error unless I write it as f(x).
Blaisem
  • 557
  • 8
  • 17
  • With gnuplot 5.2.5 there is no issue with this line. So it must be something else with your code (which you haven't provided) and maybe fitting before this line. Which version of gnuplot are you using? – theozh Mar 13 '19 at 18:32
  • @theozh Hello. Thanks for the reply. I actually figured it out. My sprintf function apparently required double quotes ("). From there, I left it as f(x) in the line for fitting my curve, but wrote f(t) in the title on the plot line. That way, both of my questions were solved. I just have to figure out how to display the fit equation in something more aesthetically mathematical. Should I close my question or submit an answer myself? – Blaisem Mar 13 '19 at 18:54
  • 1
    strange... my gnuplot accepts `"` and `'`. Well, you can answer your own question yourself and also accept the answer, at least, then your question appears as answered and problem solved. You could use `sprintf("f(t) = %.2f(1-e^{-t/%.2f})", a, tau)` which puts `-t/tau` as superscript. Well, still not very aesthetical. – theozh Mar 13 '19 at 20:19

0 Answers0