# How can I shade specific regions between two curves in a Plot?

From

Plot[{
((0.707106 Sqrt[1 - 1.5 s13^2] + 0.5 s13)^2)/(1 - s13^2),
((0.707106 Sqrt[1 - 1.5 s13^2] - 0.5 s13)^2)/(1 - s13^2)},
{s13, 0.0, 0.23},
PlotRange -> {{0.0, 0.23}, {0.35, 0.67}}, Frame -> True,
FrameLabel -> {FrameLabel -> {sin13, sin223}},
PlotStyle -> {{Gray, Thick}, {Brown,Thick}},
LabelStyle -> Directive[Black, Bold], Filling -> True,
FillingStyle -> Directive[Opacity[.19], Green]
]


I obtained this

But I want to shade definite regions of the axes with different colors. Like

sorry for poor quality of the 2nd picture

-
You can try combining this Plot with a RegionPlot using Show. – Spawn1701D May 23 '13 at 2:45

With ParametricPlot, you can use Mesh and its friends. The MeshShading is a matrix of colors that maps onto the grid created by the mesh. Here it's 3 x 4 color matrix. Apply ParametricPlot to {s13, f (1 - t) + g t} which interpolates between the two curves.

With[{f = ((0.707106 Sqrt[1 - 1.5 s13^2] + 0.5 s13)^2)/(1 - s13^2),
g = ((0.707106 Sqrt[1 - 1.5 s13^2] - 0.5 s13)^2)/(1 - s13^2)},
Show[
ParametricPlot[
{s13, f (1 - t) + g t}, {s13, 0.0, 0.23}, {t, 0, 1},
PlotRange -> {{0.0, 0.23}, {0.35, 0.67}},
MeshFunctions -> {#1 &, #2 &},  (* x, y *)
Mesh -> {{0.04, 0.1, 0.15}, {0.46, 0.54}}, (* x, y coords *)
MeshStyle -> None,
{Directive[Opacity[.19], Green], Directive[Opacity[.19], Green],
Green, Directive[Opacity[.19], Green]},
{Directive[Opacity[.19], Green], Yellow, Brown, Yellow},
{Directive[Opacity[.19], Green], Directive[Opacity[.19], Green],
Green, Directive[Opacity[.19], Green]}},
Frame -> True, FrameLabel -> {sin13, sin223},
AspectRatio -> 1/GoldenRatio],
Plot[{f, g}, {s13, 0.0, 0.23},
PlotStyle -> {Directive[Gray, Thick], Directive[Brown, Thick]}]
]
]


I had to add the boundary lines by hand using Plot, since there can be only a single BoundaryStyle.

(Edit notice: Originally, I goofed and made the boundary line straight lines.)

-
@Micael E2 thanks a lot, this is what i wanted. – Biswajit May 23 '13 at 5:25
@BiswajitKarmakar You're welcome. Note the fix to the boundary lines. I was tired and carelessly made them straight -- and they looked right, but the fix will work with graphs that are more curved. – Michael E2 May 23 '13 at 11:55
@Micael E2, I noticed that (zooming the image in output of the code),thinking what's going on. I'm learning these ParametricPlot, Mesh etc. stuffs now. – Biswajit May 23 '13 at 13:34

Perhaps something like:

Plot[{x, -x,
UnitStep[x - 2.5],   -UnitStep[x - 2.5],
x UnitBox[x - 2.5], - x UnitBox[x - 2.5]},
{x, 0, 4},
PlotStyle -> Join[Blue {1, 1}, ConstantArray[None, 4]],
Filling -> {1 -> {2}, 3 -> {4}, 5 -> {6}}]


-
thanks a lot for your suggestion. – Biswajit May 23 '13 at 5:24