How can I fill the part above the line given in Epilog with light gray or something?
Plot[{2 Sin[x], 3 x - 2, x^2}, {x, 0, 3}, GridLines -> Automatic,
Epilog -> {Directive[Red, Dashed, Thickness[0.008]],
Line[{{0, 1}, {1, 1}, {10, 10}}]}]
Clear["Global`*"]
Show[
ListLinePlot[{{0, 1}, {1, 1}, {10, 10}},
PlotStyle -> Directive[Red, Dashed, Thickness[0.008]],
Filling -> Top,
FillingStyle -> Lighter[Gray, 0.85]],
Plot[{2 Sin[x], 3 x - 2, x^2}, {x, 0, 3}, GridLines -> Automatic],
PlotRange -> {{0, 3}, Automatic}]
EDIT: To obscure the lines by the Filling
(adjust the Opacity
to taste)
Show[
Plot[{2 Sin[x], 3 x - 2, x^2}, {x, 0, 3}, GridLines -> Automatic],
ListLinePlot[{{0, 1}, {1, 1}, {10, 10}},
PlotStyle -> Directive[Red, Dashed, Thickness[0.008]], Filling -> Top,
FillingStyle -> Opacity[0.75, LightGray]]]
Show
. Does that matter?
$\endgroup$
Show
overlays the graphics: the first is the background and the second is the foreground. If the foreground is opaque you cannot see the corresponding background
$\endgroup$
Commented
Mar 28, 2021 at 16:26
Construct a polygon using the coordinates of the epilog line:
Plot[{2 Sin[x], 3 x - 2, x^2}, {x, 0, 3}, GridLines -> Automatic,
Epilog -> {Directive[Red, Dashed, Thickness[0.008]],
Line[{{0, 1}, {1, 1}, {10, 10}}],
LightGray, Opacity[.5],
Polygon[{{0, 1}, {1, 1}, {10, 10},
Scaled[{0, 1}, {10, 10}],
Scaled[{0, 1}, {0, 1}]}]}]
FilledCurve
work for Line
.
line = Line[{{0, 1}, {1, 1}, {10, 10}, {0, 10}}];
Plot[{2 Sin[x], 3 x - 2, x^2}, {x, 0, 3}, GridLines -> Automatic,
Epilog -> {{Gray, Opacity[.5], FilledCurve[line]},
Directive[Red, Dashed, Thickness[0.008]],
Line[{{0, 1}, {1, 1}, {10, 10}}]}]