From: Michael H. <mh...@al...> - 2018-01-12 16:11:10
|
On Wed, Jan 10, 2018 at 8:02 PM, allu krishna <kri...@gm...> wrote: > I am working on a project in python language. I came to know about > gnuplot-py module. In my project there is a necessity to use "gnuplot fit". > Where a small piece of code given below to be implemented, > > gnuplot> f(x,y)=a*exp(-(b)/x)*y**(c) > gnuplot> fit f(x,y) 'GNUPLOT_INPUT_TGA1.dat' using 1:2:3:(1) via a,b,c > > I want to implement the above two lines of code in my project via > gnuplot-py. I am wondering whether is it possible to implement "gnuplot fit" > concept in my python code via gnuplot-py ? You can pass arbitrary commands to gnuplot via Gnuplot.py, like >>> import Gnuplot >>> g = Gnuplot.Gnuplot() >>> g('plot sin(x)') However, if you want to get the numerical results of the fit, then you will somehow have to parse the output emitted by gnuplot. Currently the communication is one-directional, so that would take some work. Alternatively, I think gnuplot writes a logfile while fitting. You could parse the contents of that file. Michael |