Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling functions on columns of data in Gnuplot

Tags:

I have column-formatted data and I want to make a splot of the logarithm 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?

like image 797
Dan Avatar asked Jun 08 '11 23:06

Dan


2 Answers

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.

like image 110
Dan Avatar answered Sep 19 '22 05:09

Dan


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.

like image 32
hanitors Avatar answered Sep 21 '22 05:09

hanitors