It is easy to create a filledcurve plot when time series data is at small regular intervals, and data changes infrequently.
But what if data is recorded only on changes?
In order to make a shaded plot for when data is '1', there needs to be another point before the change in value (the ZZ.999 values):
# test shaded
#
t, v1
0, 0
9.999, 0
10, 1
14.999, 1
15, 0
29.999, 0
30, 1
44.999,1
45, 0
59.999,0
60, 1
64.999, 1
65, 0
This is done by:
set datafile separator ","
set datafile commentschar '#'
set key autotitle columnhead # use the first line as title for data
fileused = 'shaded.csv'
set xtics 5
set xrange[0:90]
set term qt size 800, 400
plot fileused using 1:2 with filledcurves
Is there a way to get the same plot, without having the ZZ.999 datapoints in the dataset, so you only need the data below?
0, 0
10, 1
15, 0
30, 1
45, 0
60, 1
65, 0
There are several plot styles that might suit. The simplest is probably plot with fillsteps
.
$DATA << EOD
0, 0
10, 1
15, 0
30, 1
45, 0
60, 1
65, 0
EOD
set datafile separator comma
set xtics 5
set xrange[0:90]
set yrange[0:1.5]
set style fill solid
plot $DATA using 1:2 with fillsteps