# How to create a custom filling with ListPlot

We have the following simple example

data = {{1, 1.5}, {2, 3}, {3, 5}, {4, -1}, {5, -9}, {6, 1}, {7, 10}};
L0 = ListPlot[data, Joined -> True, Axes -> False, Frame -> True,
PlotRange -> {{1, 7}, {-10, 10}}]

The joined line divides the plane into two areas (upper and lower). Is there any easy way to paint, let's say green the upper area and red the lower, while the line should be still visible?

data2 = {{1, 10}, {7, 10}}; data = {{1, 1.5}, {2, 3}, {3,
5}, {4, -1}, {5, -9}, {6, 1}, {7, 10}}; L0 =
ListPlot[{data2, data}, Joined -> True, Axes -> False, Frame -> True,
PlotRange -> {{1, 7}, {-10, 10}},
Filling -> {1 -> {{2}, Green}, 2 -> {Bottom, Red}},
PlotStyle -> {Automatic, {Black, Thickness[0.02]}}]

you can also use Show as follows:

L0 = ListPlot[{data}, Joined -> True, Axes -> False, Frame -> True,
PlotRange -> {{1, 7}, {-10, 10}}, Filling -> {1 -> { Bottom, Red}} ,
PlotStyle -> {Black, Thickness[0.02]}];
L1 =ListPlot[{data}, Joined -> True, Axes -> False, Frame -> True,
PlotRange -> {{1, 7}, {-10, 10}}, Filling -> {1 -> { Top, Green}} ,
PlotStyle -> {Black, Thickness[0.02]}];
Show[L0, L1]
• The line between the two areas is not visible any more Commented Jan 17, 2015 at 16:16

An alternative syntax using FillingStyle explicitly

data = {{1, 1.5}, {2, 3}, {3, 5}, {4, -1}, {5, -9}, {6, 1}, {7, 10}};
L0 = ListPlot[data, Joined -> True, Axes -> False, Frame -> True,
PlotRange -> {{1, 7}, {-10, 10}},
PlotStyle -> Directive[Black, AbsoluteThickness[5]],
Filling -> {1 -> Top, 1 -> Bottom}, FillingStyle -> {Green, Red}]