Reputation: 23
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.
Upvotes: 2
Views: 899
Reputation: 78
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.
Upvotes: 3