开发者

Calling functions on columns of data in Gnuplot

I have column-formatted data and I want to make a splot of the logarith开发者_开发技巧m of the 5th column versus the first two columns. I have tried:

set pm3d map
splot "thing.file" u 1:2:log($5)

But I get the error

undefined value

How can I get gnuplot to plot a function of one of the columns of data?


This works:

splot "thing.file" u 1:2:(log($5)) 

In general, if a term is defined by a function of a column in a data file rather than the column itself, there need to be parentheses around that term.


To extend the solution, you can use multiple columns if your function requires multiple inputs: example:

plot "file" using 1:(x=$2, y=$3, f(x,y)) 

also works.


Taken from gnuplot's own FAQ , "Gnuplot has been and is a plotting program,not a data processing or mathematical program suite. Therefore gnuplot can't do that.".

You can run your data file through Octave or Matlab to generate the log files before plotting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜