# Adding a thick curve to a regionplot

Suppose we have the following simple RegionPlot:

f[x_] := 1 - x^2
g[x_] := 1 - 0.5 x^2
RegionPlot[{y < f[x], f[x] < y < g[x], y > g[x]}, {x, 0, 2}, {y, 0, 2}] Now I'm trying to change the curve defined by $y=g[x]$ into a thick black curve, while leaving all other boundaries in the plot unchanged. I've tried adding the region $y=g[x]$ and playing with the plotstyle, which didn't work, and I've tried BoundaryStyle, which changed all the boundaries in the plot. Now I'm kinda out of ideas... Any help would be appreciated!

With

 f[x_] := 1 - x^2
g[x_] := 1 - 0.5 x^2


You can use Epilog to add the thick line:

 RegionPlot[{y < f[x], f[x] < y < g[x], y > g[x]}, {x, 0, 2}, {y, 0, 2},
PlotPoints -> 50,
Epilog -> (Plot[g[x], {x, 0, 2}, PlotStyle -> {Black, Thick}][]),
PlotStyle -> {Directive[Yellow, Opacity[0.4]],
Directive[Pink, Opacity[0.4]],
Directive[Green, Opacity[0.4]]}]


or a combination of MeshFunctions, MeshStyle and Mesh with a small value (somehow 0. does not work):

RegionPlot[{y < f[x], f[x] < y < g[x], y > g[x]}, {x, 0, 2}, {y, 0, 2},
PlotPoints -> 50,
Mesh -> {{0.00001}}, MeshFunctions -> {Abs[#2 - g[#1]] &},
MeshStyle -> Thick,
PlotStyle -> {Directive[Yellow, Opacity[0.4]],
Directive[Pink, Opacity[0.4]],
Directive[Green, Opacity[0.4]]}]


or Show to show the region plot with a second plot containing the thick line:

Show[RegionPlot[{y < f[x], f[x] < y < g[x], y > g[x]}, {x, 0, 2}, {y, 0, 2},
PlotPoints -> 50,
PlotStyle -> {Directive[Yellow, Opacity[0.4]],
Directive[Pink, Opacity[0.4]],
Directive[Green, Opacity[0.4]]}],
Plot[g[x], {x, 0, 2}, PlotStyle -> {Black, Thick}]]


to get • Ah, I tried some stuff with Epilog but didn't know I could put a Plot function inside. This is perfect, thanks a lot! – ScroogeMcDuck Aug 24 '14 at 9:52
• @ScroogeMcDuck, my pleasure. Please note the pattern Plot[...][] -- not Plot[...] -- on the rhs of Epilog. And, thank you for the accept. Btw, it is advised that you wait a while before accepting an answer to encourage alternative/better answers. – kglr Aug 24 '14 at 10:02
• Alright, I'll keep it in mind. – ScroogeMcDuck Aug 24 '14 at 10:32
Show[
RegionPlot[{y < f[x], f[x] < y < g[x], y > g[x]}, {x, 0, 2}, {y, 0, 2}],
RegionPlot[y > g[x], {x, -0.1, 2.1}, {y, -0.1, 2.1},
BoundaryStyle -> Directive[Thick, Black]], 