'How to perform a simple calculation to with my bash script variables in gnuplot

I have variables M_i and M > M_i. I want to make a splot where one of the columns of my data file is evaluated using these variables...

Something like this:

splot "9.90000000orbs.dat" u 1:2:(10+4*($M-$M_i))

I can't figure out the correct syntax for the last column specification. How do I do it?

Thanks in advance.



Solution 1:[1]

Your question is not clear enough. Let's say you want to plot column 4 when data of column 3 are greater than variable m =>

if (!exist("m")){m=14}
splot "9.90000000orbs.dat" u 1:2:($3<m ? $3: $4)

or give two line example of your file and more explanation.

You can invoke from bash using :

$> gnuplot file.plt -e "m=$M"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 douardo