I need to plot a semi-opaque band from y=1.95 to y=2.05 (blue colored/shaded). How would I go about doing this? My range is from x=0 to x=2.


2 Answers 2


If you want to combine it with a Plot use Epilog.

Plot[2.3 Sin[x], {x, 0, 2}, PlotStyle -> Red, 
Epilog -> {Opacity[0.5], Blue, Rectangle[{0, 1.95}, {2, 2.05}]}]

enter image description here

Or you can simply use it with Graphics.

Graphics[{Opacity[0.5], Blue, Rectangle[{0, 1.95}, {2, 2.05}]}]

You can also try Show:

Show[Plot[2.3Sin[x],{x,0,2},PlotStyle -> Red], 
Plot[2.05, {x,0,2}, Filling->1.95, PlotStyle->Opacity[0]]]]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.