# Still on Filling

I am really sorry to bother you for the same problems, but I cannot get in the view about this command, the filling option.

What I want: to fill the semicircle part, under the $$y = x$$ curve. Here is what I did so far, but there is a slight piece filled in excess. Can you please tell me how I would proceed?

f[x_] = 1 + Sqrt[1 - (x - 1)^2];
h[x_] = x;
g[x_] = 1 - Sqrt[1 - (x - 1)^2];
Plot[{f[x], g[x], h[x],
ConditionalExpression[h[x], 0 < x < 2]}, {x, -1, 3},
AspectRatio -> Automatic,
PlotStyle -> {{Darker@Cyan, Dashed}, {Darker@Cyan,
Dashed}, {Darker@Green, Dashed}, Darker@Green},
Filling -> {3 -> {2}}, FillingStyle -> {None, LightRed},
PlotRange -> {-1.5, 2.5}, AxesStyle -> Arrowheads[{0.05}],
GridLines -> {{{-2, {Thick, AbsoluteDashing[{3, 3}]}}}, None},
Epilog -> {{AbsoluteThickness[1.75]}, AbsoluteDashing[3, 3],
Line[{{1 + 1/Sqrt[2], 0}, {1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}}],
Line[{{1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}, {0, 1 + 1/Sqrt[2]}}]}]


## 4 Answers

r = RegionPlot[(x - 1)^2 + (y - 1)^2 < 1 && x > y, {x, -1.5,
2.5}, {y, -1.5, 2.5}, PlotPoints -> 100, BoundaryStyle -> None,
PlotStyle -> LightRed, AxesStyle -> Arrowheads[{0.05}],
Axes -> True, Frame -> False];

Show[
r,
Plot[{f[x], g[x], h[x],
ConditionalExpression[h[x], 0 < x < 2]}, {x, -1, 3},
AspectRatio -> Automatic,
PlotStyle -> {{Darker@Cyan, Dashed}, {Darker@Cyan,
Dashed}, {Darker@Green, Dashed}, Darker@Green},
PlotRange -> {-1.5, 2.5}],
Epilog -> {{AbsoluteThickness[1.75]}, AbsoluteDashing[3, 3],
Line[{{1 + 1/Sqrt[2], 0}, {1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}}],
Line[{{1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}, {0, 1 + 1/Sqrt[2]}}]}]


Try the following:

f[x_] = 1 + Sqrt[1 - (x - 1)^2];
h[x_] = x;
g[x_] = 1 - Sqrt[1 - (x - 1)^2];
f1 = Plot[{f[x], g[x], h[x],
ConditionalExpression[h[x], 0 < x < 2]}, {x, -1, 3},
AspectRatio -> Automatic,
PlotStyle -> {{Darker@Cyan, Dashed}, {Darker@Cyan,
Dashed}, {Darker@Green, Dashed}, Darker@Green},
Filling -> {3 -> {1}}, FillingStyle -> {None, White},
PlotRange -> {-1.5, 2.5}, AxesStyle -> Arrowheads[{0.05}],
GridLines -> {{{-2, {Thick, AbsoluteDashing[{3, 3}]}}}, None},
Epilog -> {{AbsoluteThickness[1.75]}, AbsoluteDashing[3, 3],
Line[{{1 + 1/Sqrt[2], 0}, {1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}}],
Line[{{1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}, {0, 1 + 1/Sqrt[2]}}]}];
f2 = Plot[{f[x], g[x], h[x],
ConditionalExpression[h[x], 0 < x < 2]}, {x, -1, 3},
AspectRatio -> Automatic,
PlotStyle -> {{Darker@Cyan, Dashed}, {Darker@Cyan,
Dashed}, {Darker@Green, Dashed}, Darker@Green},
Filling -> {3 -> {2}}, FillingStyle -> {None, LightRed},
PlotRange -> {-1.5, 2.5}, AxesStyle -> Arrowheads[{0.05}],
GridLines -> {{{-2, {Thick, AbsoluteDashing[{3, 3}]}}}, None},
Epilog -> {{AbsoluteThickness[1.75]}, AbsoluteDashing[3, 3],
Line[{{1 + 1/Sqrt[2], 0}, {1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}}],
Line[{{1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}, {0, 1 + 1/Sqrt[2]}}]}];
Show[f2, f1]


Graphics[{
FaceForm[LightRed], EdgeForm[],
Disk[{1, 1}, 1, {Pi/4, Pi/4 - Pi}],
AbsoluteThickness[1.75], Dashed, Black,
Line[{{1 + 1/Sqrt[2], 0}, {1 + 1/Sqrt[2], 1 + 1/Sqrt[2]}, {0, 1 + 1/Sqrt[2]}}],
Darker @ Cyan, Circle[{1, 1}],
Darker @ Green, InfiniteLine[{{0, 0}, {2, 2}}],
Dashing[{}], Line[{{0, 0}, {2, 2}}]},
PlotRange -> {{-1.5, 2.5}, {-1.5, 2.5}},
Axes -> True,
AxesStyle -> Arrowheads[{0.05}]]


• Really Elegant! Mar 27 at 19:22

Here's a start:

RegionPlot[x^2 + y^2 < 1 \[And] y < x, {x, -1, 1}, {y, -1, 1},
PlotStyle -> LightPink,
PlotPoints -> 100,
Epilog -> {Darker[Green], Thickness[0.01], Dashing[0.01],
Line[{{-1, -1}, {1, 1}}]}]