pgfplots | Logarithmic Trend LineGnuplot • logarithmic • pgfplots • plotting • Add tags
7 posts
• Page 1 of 1
Re: pgfplots | Logarithmic Trend LineIt is possible to let Gnuplot do the job in the background. Perhaps you can give a concrete example where you show which function you want to fit to which data set.
Thorsten LaTeX Community Moderator
How to make a "Minimal Example" Board Rules Avoidable Mistakes ¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351) ² Posting stopped indefinitely due to offenses
Re: pgfplots | Logarithmic Trend Linehi Thorsten, yes I did see mentions of Gnuplot online but was reluctant to go with it before I knew for certain that it wasn't possible with pgfplots alone. below is an example data set with the log function.
f(x)=16.09(x)-32.60 I do not know how I would write this into a MWE as i'm not familiar with Gnuplot. kind regards, Katie
Re: pgfplots | Logarithmic Trend Line
This is actually a linear function f(x)=ax+b and not a logarithmic one. And is it already complete with fixed coefficients a=16.09 and b=-32.6 . So you only need to plot exactly this function in addition to your data set.Linear regression can easily be done with pgfplots (see Section 4.23 of the package manual) in conjunction with pgfplotstable. Just follow the instructions and you can add an automatically fitted function to your data plot. And with a concrete example I actually meant a self-contained and minimal example that shows exactly what you are doing. For specific help it's important to know your settings. LaTeX Community Moderator
How to make a "Minimal Example" Board Rules Avoidable Mistakes ¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351) ² Posting stopped indefinitely due to offenses
Re: pgfplots | Logarithmic Trend LineHi Thorsten,
Sorry I typed it wrong. This is the correct function. f(x)=16.09 ln(x)-32.60 Here is the graph as I would have it in my document without the function.
data in file "RF_wetness_tensileindex.dat"
kind regards, Katie
Re: pgfplots | Logarithmic Trend LineYou can simply add this function to the same plot.
For details about allowed functions please refer to the PGF manual. But as I already mentioned in an earlier reply, you can let Gnuplot do the fitting in the background. For your example this would look like the following.
The resulting output is attached. This requires that you know a bit about scripts for Gnuplot and its syntax. But this way you don't have to do the fitting by hand or other tools that don't cooperate with LaTeX directly. The determined values for the variables a and b can only be found in the terminal output, but not in the log file (*.log). Gnuplot finds a=16.0891 and b=-32.6035 after five iterations. So your function is quite close.
LaTeX Community Moderator
How to make a "Minimal Example" Board Rules Avoidable Mistakes ¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351) ² Posting stopped indefinitely due to offenses
Re: pgfplots | Logarithmic Trend LineI see now, I can just add the function as a plot as I have the variables! Brilliant. Although, if I had enough time I would learn how to use Gnuplot instead of faffing with spreadsheets.
Many thanks for your help Thorsten.
7 posts
• Page 1 of 1
Topic TagsGnuplot • logarithmic • pgfplots • plottingReturn to Graphics, Figures & Tables Who is onlineUsers browsing this forum: Google [Bot] and 9 guests |