# Fill total area between two ListLinePlot plots

I have following problem. There are two functions given with discrete set of coordinates. I would like to fill complete area between them, but Mathematica fills them only until x=5. Any help is appreciated.

X1 = {0, 0.102013, 0.447045, 0.816955, 1.06637, 1.20237, 1.2705,1.28662, 1.30269, 1.36913, 1.49108, 1.6765, 1.89496, 2.06388,2.10938, 2.1562, 2.35721, 2.70695, 3.14122, 3.5419, 3.79733,3.85986, 3.92178, 4.16235, 4.49912, 4.79599, 4.9571, 4.99823, 5.};
Y1 = {5., 4.99823, 4.9571, 4.79599, 4.49912, 4.16235, 3.92178,3.85986, 3.79733, 3.5419, 3.14122, 2.70695, 2.35721, 2.1562,2.10937, 2.06388, 1.89496, 1.6765, 1.49108, 1.36913, 1.30269,1.28662, 1.2705, 1.20237, 1.06637, 0.816955, 0.447045, 0.102013, 0};
X2 = {0, 0.118858, 0.612468, 1.59423, 2.27622, 2.02751, 1.55006,1.65056, 1.50262, 1.02228, 0.539228, 0.283648, 0.35909, 0.568677, 0.634181, 0.745062, 1.21623, 1.99547, 2.82122, 3.46227, 3.86427, 3.90652, 4.01429, 4.44091, 5.19262, 5.93242, 5.80453, 5.57354,5.51724};
Y2 = {5.41777, 5.47029, 5.69091, 5.84341, 5.15434, 4.42048, 3.99531,3.95386, 3.84854, 3.44837, 2.80776, 1.98301, 1.20879, 0.74509,0.634181, 0.568647, 0.369047, 0.307631, 0.577633, 1.07383, 1.56406,1.46727, 1.62223, 2.09283, 2.3469, 1.66028, 0.638081, 0.122543,0};

ListLinePlot[{
Table[{X1[[i]], Y1[[i]]}, {i, 1, 29}],
Table[{X2[[i]], Y2[[i]]}, {i, 1, 29}]
}
, Filling -> {1 -> {2}}
]


• X1 // Max is 5 so what do you expect later? What you see is correct. FYI: ListLinePlot[Transpose /@ {{X1, Y1}, {X2, Y2}}, Filling -> {1 -> {2}}]
– Kuba
Jun 22, 2017 at 12:39
• Sorry for not being clear, I need help to fill complete area between curves. X2//Max is >5 Jun 22, 2017 at 12:45

I guess this is what you want:

With[{      l1 = Transpose@{X1, Y1},      l2 = Transpose@{X2, Y2}      },
Graphics[
{ EdgeForm@None, FaceForm@LightBlue, Polygon[Join[l1, Reverse@l2]]
, Thick, Blue, Line @l1
, Red, Line@l2
}, Frame -> True, AspectRatio -> 1/GoldenRatio
] ]


• yes, thank you very much! I was hoping to solution with ListLinePlot, but this works equally well. Jun 22, 2017 at 13:04

I was hoping to solution with ListLinePlot

l1 = Transpose@{X1, Y1}; l2 = Transpose@{X2, Y2}; l3 = Join[l1, Reverse@l2];

ListLinePlot[{l1, l2, l3}, PlotStyle->{Red, Blue, None}, Filling->{3 -> {{2}, LightBlue}}]