# A part of a plot is shaded

How can we obtain a plot that is shaded in a part. For example this plot:

One can use Prolog:

Plot[Cos[x],{x,-6,6},
Prolog->{Opacity[0.2],Rectangle[{3,-1},{6,1}]}]


This gives

• To fill the actual bounds of range of plot as OP, we use Scaled or ImageScaled.

• For the range of OP, we set {{.7, 0}, {1., 1.}} as the range, see the illustration as below.

Graphics[{LightBlue, Rectangle[], LightRed,
Rectangle @@ {{.7, 0}, {1., 1.}}, Black,
Text[Style[{.7, 0}, 14], {.7, 0}, Background -> Yellow],
Text[Style[{1, 1}, 14], {1., 1.}, Background -> Yellow]}]


• When we need the shadow does not cover the AxesLabel.
Plot[Cos[x], {x, -2 π, 2 π}, PlotStyle -> Red,
AxesLabel -> {Style["x", Red, 15], Style["y", Red, 15]},
Epilog -> {GrayLevel[.3], Opacity[.5],
Rectangle @@ Scaled /@ {{0.7, 0}, {1., 1.}}}]


• If we need to cover the AxesLabel, we should use ImageScaled and PlotRangeClipping -> False instead of Scaled.
Plot[Cos[x], {x, -2 π, 2 π}, PlotStyle -> Red,
AxesLabel -> {Style["x", Red, 15], Style["y", Red, 15]},
Epilog -> {GrayLevel[.3], Opacity[.5],
Rectangle @@ ImageScaled /@ {{0.7, 0}, {1., 1.}}},
PlotRangeClipping -> False]