As @mgilson already described in his solution: reverse one dataset and let gnuplot close and fill the curve.
So, just for fun and the records. I haven't found any way to do it without the help of external tools with the gnuplot version at the time of OP's question (gnuplot 4.6.0). However, starting at least from gnuplot 5.0.3 when plotting style with table
was introduced, there is a way, and even a simpler version for gnuplot>=5.2.0.
I'm aware that this is probably less efficient than with external tools,
but it is gnuplot-only and hence really platform-independent!
As the OP wants to plot the noisy curves but only wants to fill the smoothed curves, simply plot the smoothed curves first into a datablock or file (as @mgilson did in his answer).
Script: (for gnuplot>=5.0.3)
Explanation:
- the second dataset will be mirrored at the y-axis
(-$1):2
and "resorted" via smooth unique
and written into a third dataset, i.e. in total it is reversed in x.
- the first dataset and the (once more) mirrored third dataset will be appended into a fourth dataset which will be used for filling.
### filledcurves for 2 datasets with different x-values
# reguires gnuplot>=5.0.3
reset session
$Data1 <<EOD
-5 5
-2 4
0 1
1 2
3 5
5 4
7 2
9 4
EOD
$Data2 <<EOD
-5 7
-1.0 6
0.5 4
1.5 6
2.5 7
6.5 5
8.0 4
9 5
EOD
set table $Data3
plot $Data2 u (-$1):2 smooth unique
set table $Data4
plot $Data1 u 1:2 w table, \
$Data3 u (-$1):2 w table
unset table
set style fill solid 0.2 noborder
plot $Data4 u 1:2 w filledcurves lc "red" ti "filledcurves", \
$Data1 u 1:2 w lp pt 7 ti "Data1", \
$Data2 u 1:2 w lp pt 7 ti "Data2"
### end of script
Script: (for gnuplot>5.2.0)
Explanation:
- this is feasible only since gnuplot 5.2.0 when indexing of datablocks was introduced
- data needs to be in a datablock (see here: gnuplot: load datafile 1:1 into datablock)
- the first dataset will be written line by line into a new dataset
- the second dataset will be appended in reverse order
### filledcurves for 2 datasets with different x-values
# reguires gnuplot>=5.2.0
reset session
$Data1 <<EOD
-5 5
-2 4
0 1
1 2
3 5
5 4
7 2
9 4
EOD
$Data2 <<EOD
-5 7
-1.0 6
0.5 4
1.5 6
2.5 7
6.5 5
8.0 4
9 5
EOD
set print $Data3
do for [i=1:|$Data1|] { print $Data1[i] }
do for [i=|$Data2|:1:-1] { print $Data2[i] }
set print
set style fill solid 0.2 noborder
plot $Data3 u 1:2 w filledcurves lc "red" ti "filledcurves", \
$Data1 u 1:2 w lp pt 7 ti "Data1", \
$Data2 u 1:2 w lp pt 7 ti "Data2"
### end of script
Result: (very similar for both scripts)
