In gnuplot, when filling the space between two curves, we do:
plot "data" using 1:2,/
"data" using 1:3,/
"data" using 1:2:3 with filledcurves,\
"data2" using 1:2,/
"data2" using 1:4,/
"data2" using 1:2:4 with filledcurves
How can I do the same, but with 1:2 of the file "data", but "3" of the file "data2"? Without modifying the databases, of course.
Namely, I want to fill the space between the 2nd column of data and the 4th column of data2. So it would be something like:
plot "data" using 1:2,/
"data2" using 1:4,/
??????????? with filledcurves
EDIT
file data sample:
1736683200 24.28 24.83 1012 79 0.0 12 56
1736694000 24.71 25.09 1011 71 0.0 17 38
1736704800 24.29 24.6 1010 70 0.0 10 53
1736715600 23.6 24.03 1012 77 0.13 7 66
1736726400 23.05 23.47 1011 79 0.32 7 79
1736737200 22.37 22.8 1010 82 0.18 3 88
1736748000 22.15 22.61 1012 84 0.22 4 66
1736758800 22.92 23.36 1012 80 0.49 2 77
1736769600 24.33 24.72 1011 73 0.35 12 41
1736780400 24.62 24.89 1010 67 0.0 15 27
....
file data2 sample:
1736676000 24.6 21.4 1011.8 0 0.0 13.0 85
1736679600 24.9 21.3 1011.6 0 0.0 16.7 83
1736683200 25.2 21.2 1011.4 0 0.0 18.5 74
1736686800 25.2 21.1 1010.9 0 0.0 18.5 76
1736690400 25.2 21.0 1010.3 0 0.0 18.5 78
1736694000 25.2 20.9 1009.8 0 0.0 20.4 82
1736697600 24.7 20.7 1009.8 0 0.0 18.5 82
1736701200 24.2 20.5 1009.7 0 0.0 16.7 83
1736704800 23.7 20.4 1009.7 0 0.0 14.8 83
1736708400 23.6 20.4 1010.3 0 0.0 13.0 85
If you check help filledcurves
, you will find the following:
The third variant fills the area between two curves sampled at the same set of x coordinates. It requires three columns of input data (x, y1, y2).
This means you can only fill between two curves from the same datafile and shared x-coordinate, but not between two files and different x-coordinates.
However, there is a workaround:
$Data1
and $Data2
$Data
$Data
as well$Data ... with filledcurves
and you will basically get a filled polygonData:
#
at the end).SO79350012_1.dat
1736676000 23.6 21.4 1011 0 0.0 13 85 #
1736683200 24.28 24.83 1012 79 0.0 12 56
1736694000 24.71 25.09 1011 71 0.0 17 38
1736704800 24.29 24.6 1010 70 0.0 10 53
1736715600 23.6 24.03 1012 77 0.13 7 66
1736726400 23.05 23.47 1011 79 0.32 7 79
1736737200 22.37 22.8 1010 82 0.18 3 88
1736748000 22.15 22.61 1012 84 0.22 4 66
1736758800 22.92 23.36 1012 80 0.49 2 77
1736769600 24.33 24.72 1011 73 0.35 12 41
1736780400 24.62 24.89 1010 67 0.0 15 27
SO79350012_2.dat
1736676000 24.6 21.4 1011.8 0 0.0 13.0 85
1736679600 24.9 21.3 1011.6 0 0.0 16.7 83
1736683200 25.2 21.2 1011.4 0 0.0 18.5 74
1736686800 25.2 21.1 1010.9 0 0.0 18.5 76
1736690400 25.2 21.0 1010.3 0 0.0 18.5 78
1736694000 25.2 20.9 1009.8 0 0.0 20.4 82
1736697600 24.7 20.7 1009.8 0 0.0 18.5 82
1736701200 24.2 20.5 1009.7 0 0.0 16.7 83
1736704800 23.7 20.4 1009.7 0 0.0 14.8 83
1736708400 23.6 20.4 1010.3 0 0.0 13.0 85
1736720000 24.0 20.4 1010.3 0 0.0 13.0 85 #
1736730000 24.6 20.4 1010.3 0 0.0 13.0 85 #
1736750000 24.2 20.4 1010.3 0 0.0 13.0 85 #
1736770000 23.6 20.4 1010.3 0 0.0 13.0 85 #
1736780400 23.9 24.8 1010.1 0 0.0 15.0 27 #
Script: (requires gnuplot>=5.2.0, because of indexing datablocks)
### fill curves between two files
reset session
FILE1 = "SO79350012_1.dat"
FILE2 = "SO79350012_2.dat"
set format x "%Y\n%m-%d\n%H:%M" timedate
set table $Data1
plot FILE1 u (sprintf("%.0f %g",$1,$2)) w table
set table $Data2
plot FILE2 u (sprintf("%.0f %g",$1,$2)) w table
unset table
set print $Data
do for [i=1:|$Data1|] { print $Data1[i] }
do for [i=|$Data2|:1:-1] { print $Data2[i] }
unset print
set style fill transparent solid 0.3 noborder
set key noautotitle noenhanced
plot FILE1 u 1:2 w lp pt 7 ti FILE1, \
FILE2 u 1:2 w lp pt 7 ti FILE2, \
$Data u 1:2 w filledcurves
### end of script
Result: