2

I have a data file which contains 2 columns like these:

2016-05-23, True
2016-05-24, True
2016-05-25, False
2016-05-26, True
2016-05-27, False
2016-05-28, False
2016-05-29, True

I would like to know how to plot the 2nd column with GNUPLOT. True is 1 and False is 0... I have been searching on the web but I did not find a solution for this case.

Thanks in advance.

1 Answer 1

3

Is this what you need?

set xdata time
set timefmt "%Y-%m-%d"
set format x "%Y-%m-%d"
f(x) = x eq "True" ? 1:0
plot 'data.txt' u 1:(f(strcol(2))) w lp

This will use f(x) to convert True/False into 1/0 values. The rest is simply date formatting.

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

Comments

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.