x0 y0 x0+dx y1 x0+2*dx y2 ...

x0 dx y0 y1 y2 ...

But problems raised when you want to plot the data file using gnuplot. The software do not recognize this new format. So the task of this article is making gnuplot understand this format.

Firstly we need to read x0 and dx out form the file. As for gnupot there is no functions like scanf in c programming language, we need to play a trick here. We use command fit to read the data out. We known that if there is only two point, the fitting result using function f(x)=a*x+b will be exact. So we use command

fit f(x) "my_format.dat" u 0:1 every ::0::1 via a,b

reset set term png font "Times,18" set output "my_format.png" f(x)=a*x+b fit f(x) "my_format.dat" u 0:1 every ::0::1 via a,b x0=f(0) dx=f(1) set xlabel "Time(ms)" set ylabel "Light Intensity(Arbitary Unit)" set mxtics 5 set mytics 2 set grid xtics mxtics ytics mytics set offset 0,0,0.05,0 plot "my_format.dat" u (x0+$0*dx):1 every ::2 with lines linewidth 2 notitle

## No comments:

## Post a Comment