Reputation: 31
I want to plot only some values from a data file My problem is: I only want to plot the lines that are the value of some column set to some value ( run_id == 0101). Is there a gnuplot command, that makes you select the lines you want to plot?
like
plot 'FTSE100.txt' using 'ATimeOnMarket' :'AAnualisedROI'
when, and only when, column: 'run_id' has the value '0101'
Upvotes: 3
Views: 234
Reputation: 310207
It looks like you could use the ternary operator to filter the file:
plot 'FTSE100.txt' using (column("ATimeOnMarket")):((column("run_id) == 101)?column("AAnualisedROI"):NaN)
You can probably make it a little easier to read with macros:
set macro
ATimeOnMarket = "column('ATimeOnMarket')"
run_id = "column('run_id')
AAnualisedROI = "column('AAnualisedROI'))
plot 'FTSE100.txt' u (@ATimeOnMarket):((@run_id == 101) ? @AAnualisedROI : NaN)
Upvotes: 1