# How to draw two vertical lines into a Plot or ParametricPlot and fill / shade the region between them?

I will give an example of a regular Plot, but I also need this to work for a ParametricPlot. Say I have

plt1=Plot[Sin[x],{x,0,2π}]


I now want to add two vertical lines, one at x=3π/4 abd on at x=5π/4. In addition, I want to shade the region between those two lines. My initial idea was to use ParametricPlot to draw the line, and I hoped it would have a Fillingoption similar to that of Plot, but it does not.

The next idea was to use

plt2=RegionPlot[3π/4<x<5π/4,{x,0,2π},{y,-1.5,1.5}]


where I deliberately draw the box a bit larger on the y-coordinate, since I want it to be clipped at the PlotRange of plt1. Now I thought I combine both plots by

Show[plt1,plt2]


which gives And this es exactly as I want it, with the one exception that

1. the shaded region contains that weird mesh of thin lines.

This problem disappears if I show them in opposite order

Show[plt2, plt1]


which gives But it also introduces the new problems that

1. the plot range would have to be manually adjusted
2. the plot is now shown with these boxed axes style, and I am not sure how to change it to the usual one of Plot.

Problem 2. is admittedly the lesser problem. But if someone could help me fix preferably 1. or otherwise 3. that would be great! Thanks!

• Does this answer your question? Filling complex areas of a ListPlot Jul 17, 2020 at 15:37
• @C.E. I Suppose it would work, thanks! The answer of Suba Thomas below might be even simpler. Jul 17, 2020 at 15:50

Prolog is useful here.
Plot[Sin[x], {x, 0, 2 π}, • If you want to pimp the box in your answer a bit, use: Prolog -> {Opacity[.2], RGBColor[0.368417, 0.506779, 0.709798], EdgeForm[Directive[Thin, RGBColor[0.368417, 0.506779, 0.709798]]], Rectangle[{3 π/4, -2}, {5 π/4, 2}]}. ; ) That is the same blue tone as the plot line, and it has the vertical lines left and right. Thanks again! Jul 17, 2020 at 16:11
• Sure, 'pimp' it to your heart's content. :) And, in case you didn't know, the default plot style is easier remembered as ColorData[97, 1]. Jul 17, 2020 at 16:52