basic conditional plotting

View: New views
2 Messages — Rating Filter:   Alert me  

basic conditional plotting

by olivier.abz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I am stuggling a bit with a conditional plotting and would appreciate a little help...
My datafile is as follow (only the 2 first line here):

0.01,0,0.5153,0.2015
0.01,1,-0.2869,0.3255
....
....

My objective is to plot the 3rd variable against the 1st one only if the 2nd variable is equal to 1.

I've got so far the basic plot function:
gnuplot>plot "/myfile_path/myfile.csv" using 1:3

Does anybody know how I could solve my problem quickly?

Thanks,

Olivier.

Re: basic conditional plotting

by Thomas Sefzick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

gnuplot>plot "/myfile_path/myfile.csv" using 1:($2==1?$3:0/0)

see
http://www.gnuplot.info/docs/node58.html

olivier.abz wrote:
Hi all,

I am stuggling a bit with a conditional plotting and would appreciate a little help...
My datafile is as follow (only the 2 first line here):

0.01,0,0.5153,0.2015
0.01,1,-0.2869,0.3255
....
....

My objective is to plot the 3rd variable against the 1st one only if the 2nd variable is equal to 1.

I've got so far the basic plot function:
gnuplot>plot "/myfile_path/myfile.csv" using 1:3

Does anybody know how I could solve my problem quickly?

Thanks,

Olivier.