I try to use Gnuplot to visualize the availability of a number of computer systems over time. For each system, I want to draw a horizontal line that is interrupted for all time periods when the system was "down".
To generate the horizontal lines I want to use the "1/0"-trick to generate a constant function which is undefined for certain x-values.
In the end, it should look like:
↑
2 ┼ ++++++++++++ +++++++++++++ ++++++++
│
1 ┼ xxxx xxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxx
│
0 └─┼────┼────┼────┼────┼────┼────┼────┼────┼────→
2011-01-01 2011-06-01
Now my question is: Gnuplot can handle time-based data with "set xdata time". Is there any way to "calculate" with time/data values? The following code illustrates what I mean (everything except of the "plot" command works.)
set xdata time
set timefmt "%Y-%m-%d"
set xrange ["2011-01-01":"2013-12-31"]
plot ((x > "2012-01-01") && (x < "2012-05-20")) ? 1 : 1/0 with lines;
Instead of interpreting "2012-01-01" as time data and converting it to its internal time representation, Gnuplot computes 2012 - 1 -1 = 2010 and interprets this as "2010 seconds after 2000-01-01 00:00:00".
Of course I could compute the Gnuplot internal time representation of all my time points manually, but I wonder if there is a more elegant and less time-consuming way.