# Just Launched: You can now import projects and releases from Google Code onto SourceForge

We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps.

## gnuplot-info

 [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: - 2007-08-26 21:38:21 ```Hello! I found quite a lot of info on fitting exponential functions but could not get a good result with my FIT_LIMIT and FIT_MAXITER. I wonder if it is possible to fit just a line in a single log plot? Or how can I use the other fitting parameters to get a fit that looks right in single log plotting style of the data below. It hasn't got many values but I can't get more. Two other not so important questions: Would there be a way to loop this over the other data columns as well? Is there a better way to get the axis labels close to the last tic posistion to save space? Any help or hints welcome Lynx ____________________________________________________________________ #set terminal png font FreeSans 14 crop size 600,400 #set xlabel "Spz" #set lmargin 20 set xrange [1:12] set xtics 1,1,11 set label 1 'Spz' at graph 0.97, graph -.05 set yrange [1e-12:9e-8] set mytics 10 #set ytics 0,1e-,1.1e-5 set label 2 'I[A]' at graph -0.05, graph 0.99 #set ylabel "P[mbar]" offset screen 0.3,0.8 rotate by 0 #set ylabel "P[mbar]" offset 4,0 rotate by 0 set key right top Left reverse set logscale y set termoption enhanced #f(x) = a*b**(x) f(x) = a * exp (-x*b) FIT_LIMIT = 1e-99 FIT_MAXITER = 0 fit [1:11] f(x) '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 via a,b #plot a*b**(x) plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, a * exp (-x*b) #, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:4 t "C_2: 2" ls 2 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:5 t "C_2: 3" ls 3 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:6 t "C_2: 4" ls 4 with lp _____________________________________________________________________ dosis.dat #Spz diameter/nm I1/A I2/a I3/A I4/A 1 400 2.6e-8 6.6e-9 1.8e-9 1.8e-10 2 350 1.8e-8 4.5e-9 1.2e-9 1.3e-10 3 300 1.3e-8 3.3e-9 8.5e-10 9.1e-11 4 210 6.1e-9 1.7e-9 4.3e-10 4.9e-11 5 140 2.6e-9 6.8e-10 1.8e-10 0 6 95 1.4e-9 4e-10 1e-10 0 7 52 6.3e-10 1.8e-10 5.2e-11 0 8 34 2.4e-10 7e-11 0 0 9 18 9.1e-11 3.3e-11 0 0 10 12 5.2e-11 0 0 0 11 9 3.8e-11 0 0 0 ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: - 2007-08-26 22:53:46 ```lynx.abraxas@... wrote: > I found quite a lot of info on fitting exponential functions but could not get > a good result with my FIT_LIMIT and FIT_MAXITER. That's not exactly surprising. A FIT_LIMIT of 1e-99 is preposterous. > I wonder if it is possible to > fit just a line in a single log plot? Not quite --- because you don't fit to a plot. You fit to data, among other things, that means that "set log y" has no effect on fits. So you have to logarithmize the data yourself to get a similar effect: set log y fit log(a)-b*x 'data' using 1:(log(\$2)) via a, b plot a*exp(-b*x), 'data' > Would there be a way to loop this over the other data columns as well? Yes. See "help reread". ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: - 2007-08-27 07:57:44 ```Thanks for your quick answer Hans-Bernhard Bröker. On 27/08/07 00:53:31, Hans-Bernhard Bröker wrote: > lynx.abraxas@... wrote: > > That's not exactly surprising. A FIT_LIMIT of 1e-99 is preposterous. I ended up there because gnuplot didn't react to any change. > > > I wonder if it is possible to > >fit just a line in a single log plot? > > Not quite --- because you don't fit to a plot. You fit to data, among > other things, that means that "set log y" has no effect on fits. So you > have to logarithmize the data yourself to get a similar effect: > > set log y > fit log(a)-b*x 'data' using 1:(log(\$2)) via a, b > plot a*exp(-b*x), 'data' Well if I use: set log y fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, a * exp (-x*b) I get: gnuplot> load 'dosis_spz_fit.gpl' No data to fit Are my y-values too small for gnuplot log? How comes it's so hard for gnuplot to do something that can be done as a simple line fit?Setting a and b by own calculations the line is close but still so far off that I can fit a better line with my eyes. Is there a way to fit the line by hand interactivly by just rotating and translating in gnuplot or would I have to use inkscape for that? Is there any way I can get a better auto fit? Thanks Lynx __________________________________________________________________ #set logscale y set termoption enhanced a= 5e-8 b= .7 FIT_LIMIT = 1e-9 FIT_MAXITER = 0 #f(x) = a * exp (-x*b) #fit f(x) '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 via a,b set log y fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, a * exp (-x*b) ________________________________________________________________________ dosis.dat #Spz diameter/nm I1/A I2/a I3/A I4/A 1 400 2.6e-8 6.6e-9 1.8e-9 1.8e-10 2 350 1.8e-8 4.5e-9 1.2e-9 1.3e-10 3 300 1.3e-8 3.3e-9 8.5e-10 9.1e-11 4 210 6.1e-9 1.7e-9 4.3e-10 4.9e-11 5 140 2.6e-9 6.8e-10 1.8e-10 0 6 95 1.4e-9 4e-10 1e-10 0 7 52 6.3e-10 1.8e-10 5.2e-11 0 8 34 2.4e-10 7e-11 0 0 9 18 9.1e-11 3.3e-11 0 0 10 12 5.2e-11 0 0 0 11 9 3.8e-11 0 0 0 ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: Thomas Sefzick - 2007-08-27 10:40:58 ```> gnuplot> load 'dosis_spz_fit.gpl' > No data to fit with the data and the script you provide i'm not able to reproduce your problem. i'm using gnuplot 4.0 and gnuplot 4.3. in both versions the fit converges after 10 iterations: http://www.nabble.com/file/p12344733/fit.log fit.log=20 http://www.nabble.com/file/p12344733/dosis.gif=20 lynx.abraxas wrote: >=20 > Thanks for your quick answer Hans-Bernhard Br=C3=B6ker. >=20 > On 27/08/07 00:53:31, Hans-Bernhard Br=C3=B6ker wrote: >> lynx.abraxas@... wrote: >> >> That's not exactly surprising. A FIT_LIMIT of 1e-99 is preposterous. >=20 > I ended up there because gnuplot didn't react to any change. >=20 >> >> > I wonder if it is possible to >> >fit just a line in a single log plot? >> >> Not quite --- because you don't fit to a plot. You fit to data, among >> other things, that means that "set log y" has no effect on fits. So you >> have to logarithmize the data yourself to get a similar effect: >> >> set log y >> fit log(a)-b*x 'data' using 1:(log(\$2)) via a, b >> plot a*exp(-b*x), 'data' >=20 > Well if I use: >=20 > set log y > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b > plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp,= =20 > a * exp (-x*b) >=20 > I get: > gnuplot> load 'dosis_spz_fit.gpl' > No data to fit >=20 > Are my y-values too small for gnuplot log? >=20 > How comes it's so hard for gnuplot to do something that can be done = =20 > as a > simple line fit?Setting a and b by own calculations the line is clos= e > but > still so far off that I can fit a better line with my eyes. Is there a= =20 > way > to fit the line by hand interactivly by just rotating and > translating in > gnuplot or would I have to use inkscape for that? >=20 > Is there any way I can get a better auto fit? >=20 > Thanks > Lynx >=20 > __________________________________________________________________ >=20 > #set logscale y > set termoption enhanced > a=3D 5e-8 > b=3D .7 > FIT_LIMIT =3D 1e-9 > FIT_MAXITER =3D 0 > #f(x) =3D a * exp (-x*b) > #fit f(x) '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 via a,b > set log y > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b > plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, a > * exp (-x*b) >=20 > ________________________________________________________________________ >=20 > dosis.dat > #Spz diameter/nm I1/A I2/a I3/A I4/A > 1 400 2.6e-8 6.6e-9 1.8e-9 1.8e-10 > 2 350 1.8e-8 4.5e-9 1.2e-9 1.3e-10 > 3 300 1.3e-8 3.3e-9 8.5e-10 9.1e-11 > 4 210 6.1e-9 1.7e-9 4.3e-10 4.9e-11 > 5 140 2.6e-9 6.8e-10 1.8e-10 0 > 6 95 1.4e-9 4e-10 1e-10 0 > 7 52 6.3e-10 1.8e-10 5.2e-11 0 > 8 34 2.4e-10 7e-11 0 0 > 9 18 9.1e-11 3.3e-11 0 0 > 10 12 5.2e-11 0 0 0 > 11 9 3.8e-11 0 0 0 >=20 >=20 >=20 > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Gnuplot-info mailing list > Gnuplot-info@... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info >=20 >=20 --=20 View this message in context: http://www.nabble.com/How-to-fit-a-line-in-lo= g-plot-or-how-to-help-converge-exp-better-tf4332385.html#a12344733 Sent from the Gnuplot - User mailing list archive at Nabble.com. ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: Thomas Sefzick - 2007-08-28 12:44:39 ```> The only thing left now is how to get the multiplot have nice axes; with reread they get > overpainted. modify 'dosis_single_fit.gpl': c_p= c_p + 1 c_l= c_p + 2 set yrange [-27.63:-16.22] fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) via a, b set yrange [1e-12:9e-8] plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with lp, a * exp (-x*b) lt c_p if (c_p < 4) reread the axes get still overpainted but with exactly the same. lynx.abraxas wrote: > > On 27/08/07 03:40:51, Thomas Sefzick wrote: >> >> > gnuplot> load 'dosis_spz_fit.gpl' >> > No data to fit >> >> with the data and the script you provide i'm not able to reproduce your >> problem. >> i'm using gnuplot 4.0 and gnuplot 4.3. >> in both versions the fit converges after 10 iterations: >> >> http://www.nabble.com/file/p12344733/fit.log fit.log >> http://www.nabble.com/file/p12344733/dosis.gif >> > I figured out that my "set yrange [1e-12:9e-8]" before the fit causes the > error. Is it in > intended that yrange effects fit? > The only thing left now is how to get the multiplot have nice axes; with > reread they get > overpainted. And what would be the most elegant way to cope with the > titels containing > the fit parameters? The first file below is what I want but done clumsy. > After that comes > my reread attempt I got stuck on. How should I handel the third case the > line of which > is missing? > > Thanks a lot for Your help > Lynx > > ________________________________________________ > > set output "Dosis.png" > set style line 1 lt 1 lw 2 > set style line 2 lt 2 lw 2 > set style line 3 lt 3 lw 2 > set style line 4 lt 4 lw 2 > #set terminal png font FreeSans 14 crop size 700,500 > set xrange [1:12] > set xtics 1,1,11 > set label 1 'Spz' at graph 0.97, graph -.05 > set mytics 10 > set label 2 'I[A]' at graph -0.05, graph 0.99 > set key right top # Left reverse > set termoption enhanced > a= 5e-8 > c= 5e-8 > e= 5e-8 > f= .8 > g= 5e-8 > b= .7 > FIT_LIMIT = 1e-9 > FIT_MAXITER = 0 > set log y > titel(s,n,t,m) = sprintf("%s= %.1e; %s= %.1e", s, n, t, m) > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b > fit log(c)-d*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$4)) via c, d > fit log(e)-f*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$5)) via e, f > fit log(g)-h*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$6)) via g, h > set yrange [1e-12:9e-8]#not before fit!!! > plot a * exp (-x*b) t titel("a",a,"b",b) lt 1, c * exp (-x*d) t > titel("a",c,"b",d) lt > 2, e * exp (-x*f) t titel("a",e,"b",f) lt 3, g * exp (-x*h) t > titel("a",g,"b",h) lt 4, > '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, '< sed > "s/ 0/ ?0/g" > dosis.dat' using 1:4 t "C_2: 2" ls 2 with lp, '< sed "s/ 0/ ?0/g" > dosis.dat' using 1:5 > t "C_2: 3" ls 3 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:6 t "C_2: > 4" ls 4 with lp > > _______________________________________________________ > > > c_p= c_p + 1 > c_l= c_p + 2 > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) > via a, b > #set yrange [1e-12:9e-8]#not before fit!!! > plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with > lp, a * exp (- > x*b) lt c_p > if (c_p < 6) reread > > ______________________________________________________ > > > set output "Dosis.png" > set style line 1 lt 1 lw 2 > set style line 2 lt 2 lw 2 > set style line 3 lt 3 lw 2 > set style line 4 lt 4 lw 2 > #set terminal png font FreeSans 14 crop size 600,400 > set xrange [1:12] > set xtics 1,1,11 > set label 1 'Spz' at graph 0.97, graph -.05 > set mytics 10 > set label 2 'I[A]' at graph -0.05, graph 0.99 > set key right top Left reverse > set termoption enhanced > a= 5e-8 > b= .7 > FIT_LIMIT = 1e-9 > FIT_MAXITER = 0 > set log y > c_p= 0 > set multiplot > call 'dosis_single_fit.gpl' 'dosis.dat' > unset multiplot > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Gnuplot-info mailing list > Gnuplot-info@... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://www.nabble.com/How-to-fit-a-line-in-log-plot-or-how-to-help-converge-exp-better-tf4332385.html#a12367253 Sent from the Gnuplot - User mailing list archive at Nabble.com. ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: - 2007-08-28 19:57:54 ```On 28/08/07 05:44:41, Thomas Sefzick wrote: > > > The only thing left now is how to get the multiplot have nice axes; with > reread they get > > overpainted. > > modify 'dosis_single_fit.gpl': > > c_p= c_p + 1 > c_l= c_p + 2 > set yrange [-27.63:-16.22] > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) > via a, b > set yrange [1e-12:9e-8] > plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with > lp, a * exp (-x*b) lt c_p > if (c_p < 4) reread > > the axes get still overpainted but with exactly the same. Ah, great. Thank You very much for the tricks. With the aliasing of the fonts it's still visible it got over paintede but the graph is fine. I changed the key line to: set key left Left reverse at graph 0.6, graph 1.05-c_p*0.1 but reverse seems to be ignored. Is that because of multiplot? Thanks again, I'm now more confident with gnuplot. Lynx ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: Thomas Sefzick - 2007-08-29 07:30:19 ```> I changed the key line to: > set key left Left reverse at graph 0.6, graph 1.05-c_p*0.1 > but reverse seems to be ignored. Is that because of multiplot? no, it's already reversed because of the line set key right top Left reverse in 'dosis_single_fit_main.gpl' the only thing you can do is an 'unreverse' or delete the 'set key' line in 'dosis_single_fit_main.gpl'. another trick which makes your script system independent: instead of calling 'sed' in fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) ... plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l ... you can get the same effect using the ternary operator in combination with gnuplot's behaviour to ignore undefined values: fit log(a)-b*x 'dosis.dat' using 1:( column(c_l)>0 ? log(column(c_l)) : 0/0 ) ... plot 'dosis.dat' using 1:( column(c_l)>0 ? column(c_l) : 0/0 ) ... lynx.abraxas wrote: > > On 28/08/07 05:44:41, Thomas Sefzick wrote: >> >> > The only thing left now is how to get the multiplot have nice axes; >> with >> reread they get >> > overpainted. >> >> modify 'dosis_single_fit.gpl': >> >> c_p= c_p + 1 >> c_l= c_p + 2 >> set yrange [-27.63:-16.22] >> fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) >> via a, b >> set yrange [1e-12:9e-8] >> plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with >> lp, a * exp (-x*b) lt c_p >> if (c_p < 4) reread >> >> the axes get still overpainted but with exactly the same. > > Ah, great. Thank You very much for the tricks. With the aliasing of the > fonts > it's still visible it got over paintede but the graph is fine. > I changed the key line to: set key left Left reverse at graph 0.6, > graph > 1.05-c_p*0.1 > but reverse seems to be ignored. Is that because of multiplot? > > Thanks again, I'm now more confident with gnuplot. > Lynx > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Gnuplot-info mailing list > Gnuplot-info@... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://www.nabble.com/How-to-fit-a-line-in-log-plot-or-how-to-help-converge-exp-better-tf4332385.html#a12382070 Sent from the Gnuplot - User mailing list archive at Nabble.com. ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: - 2007-08-28 10:44:24 ```On 27/08/07 03:40:51, Thomas Sefzick wrote: > > > gnuplot> load 'dosis_spz_fit.gpl' > > No data to fit > > with the data and the script you provide i'm not able to reproduce your > problem. > i'm using gnuplot 4.0 and gnuplot 4.3. > in both versions the fit converges after 10 iterations: > > http://www.nabble.com/file/p12344733/fit.log fit.log > http://www.nabble.com/file/p12344733/dosis.gif > I figured out that my "set yrange [1e-12:9e-8]" before the fit causes the error. Is it in intended that yrange effects fit? The only thing left now is how to get the multiplot have nice axes; with reread they get overpainted. And what would be the most elegant way to cope with the titels containing the fit parameters? The first file below is what I want but done clumsy. After that comes my reread attempt I got stuck on. How should I handel the third case the line of which is missing? Thanks a lot for Your help Lynx ________________________________________________ set output "Dosis.png" set style line 1 lt 1 lw 2 set style line 2 lt 2 lw 2 set style line 3 lt 3 lw 2 set style line 4 lt 4 lw 2 #set terminal png font FreeSans 14 crop size 700,500 set xrange [1:12] set xtics 1,1,11 set label 1 'Spz' at graph 0.97, graph -.05 set mytics 10 set label 2 'I[A]' at graph -0.05, graph 0.99 set key right top # Left reverse set termoption enhanced a= 5e-8 c= 5e-8 e= 5e-8 f= .8 g= 5e-8 b= .7 FIT_LIMIT = 1e-9 FIT_MAXITER = 0 set log y titel(s,n,t,m) = sprintf("%s= %.1e; %s= %.1e", s, n, t, m) fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b fit log(c)-d*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$4)) via c, d fit log(e)-f*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$5)) via e, f fit log(g)-h*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$6)) via g, h set yrange [1e-12:9e-8]#not before fit!!! plot a * exp (-x*b) t titel("a",a,"b",b) lt 1, c * exp (-x*d) t titel("a",c,"b",d) lt 2, e * exp (-x*f) t titel("a",e,"b",f) lt 3, g * exp (-x*h) t titel("a",g,"b",h) lt 4, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:4 t "C_2: 2" ls 2 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:5 t "C_2: 3" ls 3 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:6 t "C_2: 4" ls 4 with lp _______________________________________________________ c_p= c_p + 1 c_l= c_p + 2 fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) via a, b #set yrange [1e-12:9e-8]#not before fit!!! plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with lp, a * exp (- x*b) lt c_p if (c_p < 6) reread ______________________________________________________ set output "Dosis.png" set style line 1 lt 1 lw 2 set style line 2 lt 2 lw 2 set style line 3 lt 3 lw 2 set style line 4 lt 4 lw 2 #set terminal png font FreeSans 14 crop size 600,400 set xrange [1:12] set xtics 1,1,11 set label 1 'Spz' at graph 0.97, graph -.05 set mytics 10 set label 2 'I[A]' at graph -0.05, graph 0.99 set key right top Left reverse set termoption enhanced a= 5e-8 b= .7 FIT_LIMIT = 1e-9 FIT_MAXITER = 0 set log y c_p= 0 set multiplot call 'dosis_single_fit.gpl' 'dosis.dat' unset multiplot ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: Thomas Sefzick - 2007-08-28 12:18:45 ```> I figured out that my "set yrange [1e-12:9e-8]" before the fit causes the error. Is it in > intended that yrange effects fit? yes, that's the normal behaviour. BUT: you are converting your y-data with log(\$3) before fitting, so for fitting the yrange should be set yrange [-24:-17] (because of log(3.8e-11) = -23.99 ; log(2.6e-8) = -17.47) for plotting set yrange [1e-12:9e-8] is right, because of 'set log y' lynx.abraxas wrote: > > On 27/08/07 03:40:51, Thomas Sefzick wrote: >> >> > gnuplot> load 'dosis_spz_fit.gpl' >> > No data to fit >> >> with the data and the script you provide i'm not able to reproduce your >> problem. >> i'm using gnuplot 4.0 and gnuplot 4.3. >> in both versions the fit converges after 10 iterations: >> >> http://www.nabble.com/file/p12344733/fit.log fit.log >> http://www.nabble.com/file/p12344733/dosis.gif >> > I figured out that my "set yrange [1e-12:9e-8]" before the fit causes the > error. Is it in > intended that yrange effects fit? > The only thing left now is how to get the multiplot have nice axes; with > reread they get > overpainted. And what would be the most elegant way to cope with the > titels containing > the fit parameters? The first file below is what I want but done clumsy. > After that comes > my reread attempt I got stuck on. How should I handel the third case the > line of which > is missing? > > Thanks a lot for Your help > Lynx > > ________________________________________________ > > set output "Dosis.png" > set style line 1 lt 1 lw 2 > set style line 2 lt 2 lw 2 > set style line 3 lt 3 lw 2 > set style line 4 lt 4 lw 2 > #set terminal png font FreeSans 14 crop size 700,500 > set xrange [1:12] > set xtics 1,1,11 > set label 1 'Spz' at graph 0.97, graph -.05 > set mytics 10 > set label 2 'I[A]' at graph -0.05, graph 0.99 > set key right top # Left reverse > set termoption enhanced > a= 5e-8 > c= 5e-8 > e= 5e-8 > f= .8 > g= 5e-8 > b= .7 > FIT_LIMIT = 1e-9 > FIT_MAXITER = 0 > set log y > titel(s,n,t,m) = sprintf("%s= %.1e; %s= %.1e", s, n, t, m) > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b > fit log(c)-d*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$4)) via c, d > fit log(e)-f*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$5)) via e, f > fit log(g)-h*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$6)) via g, h > set yrange [1e-12:9e-8]#not before fit!!! > plot a * exp (-x*b) t titel("a",a,"b",b) lt 1, c * exp (-x*d) t > titel("a",c,"b",d) lt > 2, e * exp (-x*f) t titel("a",e,"b",f) lt 3, g * exp (-x*h) t > titel("a",g,"b",h) lt 4, > '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, '< sed > "s/ 0/ ?0/g" > dosis.dat' using 1:4 t "C_2: 2" ls 2 with lp, '< sed "s/ 0/ ?0/g" > dosis.dat' using 1:5 > t "C_2: 3" ls 3 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:6 t "C_2: > 4" ls 4 with lp > > _______________________________________________________ > > > c_p= c_p + 1 > c_l= c_p + 2 > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) > via a, b > #set yrange [1e-12:9e-8]#not before fit!!! > plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with > lp, a * exp (- > x*b) lt c_p > if (c_p < 6) reread > > ______________________________________________________ > > > set output "Dosis.png" > set style line 1 lt 1 lw 2 > set style line 2 lt 2 lw 2 > set style line 3 lt 3 lw 2 > set style line 4 lt 4 lw 2 > #set terminal png font FreeSans 14 crop size 600,400 > set xrange [1:12] > set xtics 1,1,11 > set label 1 'Spz' at graph 0.97, graph -.05 > set mytics 10 > set label 2 'I[A]' at graph -0.05, graph 0.99 > set key right top Left reverse > set termoption enhanced > a= 5e-8 > b= .7 > FIT_LIMIT = 1e-9 > FIT_MAXITER = 0 > set log y > c_p= 0 > set multiplot > call 'dosis_single_fit.gpl' 'dosis.dat' > unset multiplot > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Gnuplot-info mailing list > Gnuplot-info@... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://www.nabble.com/How-to-fit-a-line-in-log-plot-or-how-to-help-converge-exp-better-tf4332385.html#a12366846 Sent from the Gnuplot - User mailing list archive at Nabble.com. ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: Thomas Sefzick - 2007-08-28 13:41:02 ```> And what would be the most elegant way to cope with the titels containing > the fit parameters? The first file below is what I want but done clumsy. > After that comes > my reread attempt I got stuck on. How should I handel the third case the > line of which > is missing? use this as 'dosis_single_fit.gpl': c_p= c_p + 1 c_l= c_p + 2 set yrange [-27.63:-16.22] fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) via a, b set key left at graph 0.5, graph 1.0-c_p*0.1 set yrange [1e-12:9e-8] ptitle(a,b) = sprintf("%e * exp(-x*%e)",a,b) plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with lp, a * exp (-x*b) title ptitle(a,b) lt c_p if (c_p < 4) reread you need to adjust the factor in 'set key...' a little bit, and the format string inside the 'sprintf' function. lynx.abraxas wrote: > > On 27/08/07 03:40:51, Thomas Sefzick wrote: >> >> > gnuplot> load 'dosis_spz_fit.gpl' >> > No data to fit >> >> with the data and the script you provide i'm not able to reproduce your >> problem. >> i'm using gnuplot 4.0 and gnuplot 4.3. >> in both versions the fit converges after 10 iterations: >> >> http://www.nabble.com/file/p12344733/fit.log fit.log >> http://www.nabble.com/file/p12344733/dosis.gif >> > I figured out that my "set yrange [1e-12:9e-8]" before the fit causes the > error. Is it in > intended that yrange effects fit? > The only thing left now is how to get the multiplot have nice axes; with > reread they get > overpainted. And what would be the most elegant way to cope with the > titels containing > the fit parameters? The first file below is what I want but done clumsy. > After that comes > my reread attempt I got stuck on. How should I handel the third case the > line of which > is missing? > > Thanks a lot for Your help > Lynx > > ________________________________________________ > > set output "Dosis.png" > set style line 1 lt 1 lw 2 > set style line 2 lt 2 lw 2 > set style line 3 lt 3 lw 2 > set style line 4 lt 4 lw 2 > #set terminal png font FreeSans 14 crop size 700,500 > set xrange [1:12] > set xtics 1,1,11 > set label 1 'Spz' at graph 0.97, graph -.05 > set mytics 10 > set label 2 'I[A]' at graph -0.05, graph 0.99 > set key right top # Left reverse > set termoption enhanced > a= 5e-8 > c= 5e-8 > e= 5e-8 > f= .8 > g= 5e-8 > b= .7 > FIT_LIMIT = 1e-9 > FIT_MAXITER = 0 > set log y > titel(s,n,t,m) = sprintf("%s= %.1e; %s= %.1e", s, n, t, m) > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$3)) via a, b > fit log(c)-d*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$4)) via c, d > fit log(e)-f*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$5)) via e, f > fit log(g)-h*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(\$6)) via g, h > set yrange [1e-12:9e-8]#not before fit!!! > plot a * exp (-x*b) t titel("a",a,"b",b) lt 1, c * exp (-x*d) t > titel("a",c,"b",d) lt > 2, e * exp (-x*f) t titel("a",e,"b",f) lt 3, g * exp (-x*h) t > titel("a",g,"b",h) lt 4, > '< sed "s/ 0/ ?0/g" dosis.dat' using 1:3 t "C_2: 1" ls 1 with lp, '< sed > "s/ 0/ ?0/g" > dosis.dat' using 1:4 t "C_2: 2" ls 2 with lp, '< sed "s/ 0/ ?0/g" > dosis.dat' using 1:5 > t "C_2: 3" ls 3 with lp, '< sed "s/ 0/ ?0/g" dosis.dat' using 1:6 t "C_2: > 4" ls 4 with lp > > _______________________________________________________ > > > c_p= c_p + 1 > c_l= c_p + 2 > fit log(a)-b*x '< sed "s/ 0/ ?0/g" dosis.dat' using 1:(log(column(c_l))) > via a, b > #set yrange [1e-12:9e-8]#not before fit!!! > plot '< sed "s/ 0/ ?0/g" dosis.dat' using 1:c_l t "C_2: \$c_p" ls c_p with > lp, a * exp (- > x*b) lt c_p > if (c_p < 6) reread > > ______________________________________________________ > > > set output "Dosis.png" > set style line 1 lt 1 lw 2 > set style line 2 lt 2 lw 2 > set style line 3 lt 3 lw 2 > set style line 4 lt 4 lw 2 > #set terminal png font FreeSans 14 crop size 600,400 > set xrange [1:12] > set xtics 1,1,11 > set label 1 'Spz' at graph 0.97, graph -.05 > set mytics 10 > set label 2 'I[A]' at graph -0.05, graph 0.99 > set key right top Left reverse > set termoption enhanced > a= 5e-8 > b= .7 > FIT_LIMIT = 1e-9 > FIT_MAXITER = 0 > set log y > c_p= 0 > set multiplot > call 'dosis_single_fit.gpl' 'dosis.dat' > unset multiplot > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Gnuplot-info mailing list > Gnuplot-info@... > https://lists.sourceforge.net/lists/listinfo/gnuplot-info > > -- View this message in context: http://www.nabble.com/How-to-fit-a-line-in-log-plot-or-how-to-help-converge-exp-better-tf4332385.html#a12368100 Sent from the Gnuplot - User mailing list archive at Nabble.com. ```
 Re: [Gnuplot-info] How to fit a line in log plot or how to help converge exp better From: - 2007-08-28 18:30:53 ```lynx.abraxas@... wrote: > I figured out that my "set yrange [1e-12:9e-8]" before the fit causes > the error. Is it in intended that yrange effects fit? Yes. It's even documented, of sorts. The fit command inherited all features from (s)plot that are useful to it, including 'using', 'every' and range specifications. > The only thing left now is how to get the multiplot have nice axes; > with reread they get overpainted. That's got nothing to do with reread. It's a generic feature of multiplots without fixed axis ranges. ```