1

I would like to plot certain data from my data set that looks like:

29/11/2014;23:52;983,0;67,8;1016,0;53,0;53,0;29,7
29/11/2014;23:53;269,0;67,8;1018,0;53,0;53,0;29,7
29/11/2014;23:54;266,0;67,8;1008,0;53,0;53,0;29,7
29/11/2014;23:55;59,0;67,8;1011,0;53,0;53,0;29,7
29/11/2014;23:56;37,0;67,8;1016,0;53,0;53,0;29,7
29/11/2014;23:57;457,0;67,8;1000,0;51,9;53,0;29,6
29/11/2014;23:58;570,0;67,8;1000,0;53,0;53,0;29,6
29/11/2014;23:59;1140,0;67,8;1001,0;53,0;52,5;29,6
30/11/2014;00:00;1040,0;67,8;1005,0;52,5;53,0;29,6
30/11/2014;00:01;443,0;67,8;1000,0;53,0;53,0;29,6
30/11/2014;00:02;229,0;67,8;1008,0;52,5;53,0;29,6
30/11/2014;00:03;1035,0;67,8;1001,0;53,0;52,5;29,5
30/11/2014;00:04;681,0;67,8;1000,0;51,9;51,9;29,5
30/11/2014;00:05;931,0;67,8;1008,0;52,5;53,0;29,5
30/11/2014;00:06;889,0;67,8;1010,0;53,0;51,9;29,5
30/11/2014;00:07;885,0;67,8;1000,0;51,9;51,9;29,4

The field separator is the semicolon and the decimal separator is the comma, the fields date and time are considered independent to each other (They are separated by a ; symbol)

This data set cover the whole month, but I only need to plot the data corresponding to today, for some reason, the plot command always ignore the data, so I suspect the command:

"plot file1 using (stringcolumn(1) == date1 ? $2:1/0):6 title " GPU" with lines, "

is malformed, but after reading a lot of net related articles, I cannot guess how.

The rest of the plot command in that line " file1 using 2:7 title " CPU" with lines" work as expected.

2
  • besides: instead of 1/0 you can write NaN, which is more readable Commented Jan 19, 2017 at 12:32
  • Thanks for your comment @krx Commented Jan 20, 2017 at 0:10

1 Answer 1

1

When you evaluate an expression inside the using statement, you must use timecolumn in order to get the correct time data. Also, for string comparison use the eq operator:

set xdata time
set timefmt '%H:%M'
set datafile separator ';'
set decimalsign locale
date1='30/11/2014'

plot 'test.dat' using (strcol(1) == date1 ? timecolumn(2) : 1/0):6 with lines title "GPU"

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks you very much, this solution worked right out the box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.