Question

I know that

gnuplot> p 'filename' 

would plot the graph

I wanted to know how does this code exactly run

gnuplot> p 'filename' u 10:(($3==4 && $9==1000)?$13:1/0) w lp
Was it helpful?

Solution

First of all, it helps a bit to expand the abbreviated commands (you are taking these from someone else's script, I assume):

plot 'filename' using 10:(($3==4 && $9==1000) ? $13 : 1/0) with linespoints

That snippet is meant to plot the 10th vs. the 13th column from a big data file based on the values in the third and ninth columns. The first argument to using is 10, so the value in the 10th column is the x coordinate of each point. The y values are determined thus: if the value in the 3rd column is 4 and the value in the 9th column is 1000, the value from the 13th column is plotted; otherwise 1/0 (no value) is plotted. That is done by the ternary operator <condition> ? <operation if true> : <operation if false>.

with linespoints means the points plotted will be connected by lines.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top