Re: How to plot multiple fit functions in a single box

Hans-Bernhard Bröker <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.user
Message-ID <[email protected]>
Am 04.07.2020 um 17:04 schrieb rekha sharma:

> f(x) = (a0 + a1/x)
> fit f(x) 'test.data' using 1:2 via a0,a1
> plot 'test.data' using 1:2 w points pt 1 t  ,  f(x) t sprintf("K_{fit} =
> a_0 +  a_1/T", a0)
[... and the same for columns 3 to 9 as the y axis]

> Using this code, I am getting a plot in eight boxes 

Using only that code, that cannot happen.  What you would get is 8 
plots, but not in 8 boxes, but rather on 8 separate pages of output (if 
your output supports that), or just a single plot window being updated 8 
times.  To get "a plot in 8 boxes", you would have to have "set 
multiplot layout ..." in effect somehow.

> Is there any workaround for this issue in gnuplot so that I can plot all
> above in a single box?

For all the above to show up in a single "box", i.e. on a single page, 
you have to change the the way you define your fit model function and 
its parameters.  And then you have to undo the parts of your scripts 
that you claim aren't there, about "set multiplot"

f(x,a0,a1) = a0 + a1/x

fit f(x,a01,a11) 'test.data' using 1:2 via a01,a11
fit f(x,a02,a11) 'test.data' using 1:3 via a02,a12
[...]

plot \
   'test.data' using 1:2 w points pt 1 t  , \
    f(x,a01,a11) t sprintf("K_{fit} = % g +  a_1/T", a01), \
   '' using 1:3 w points pt 1 t  , \
    f(x,a02,a12) t sprintf("K_{fit} = % g +  a_1/T", a02), \
   '' using 1:4 w points pt 1 t  , \
    f(x,a03,a13) t sprintf("K_{fit} = % g +  a_1/T", a03), \
[...]

If your gnuplot is new enough, the above can be improved upon using for 
loops for the fits and the parts of the plot, and arrays for the 
parameters.  And you'll want to re-think that sprintf, I think.

That will give you a rather packed diagram, though.


_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.