# disable lines in RegionPlot when set is not bounded

Im trying to plot a horizontal strip in the (x,y)-plane with -1 < y < 1. I achieved this:

RegionPlot[
y^2 <= 1,
{x, -2, 2},
{y, -2, 2},
Frame -> False,
BoundaryStyle -> Directive[Thickness[Medium], Dashed],
Axes -> True,
AxesOrigin -> {0, 0}
]


As you can see I used dashed lines for the boundary. However mathematica draws this dashed line also at the left and right boundaries but theoretically my set is unbounded to the left and right. I would like to keep the lines on the top and on the bottm, but loosing them left and right.

• Not a great idea, but reducing horizontal PlotRange to PlotRange -> {{-1.99,1.99},{-2,2}} cutts off left/right border. – Alx Nov 6 '19 at 12:49

RegionPlot[y^2 <= 1, {x, -2, 2}, {y, -2, 2},

• @Arjihad, the combination MeshFunctions -> {#2 &} and  Mesh -> {{-1, 1}} works for the specific case in your post. It does not work for all predicates in the first argument of RegionPlot. You need to make changes to the MeshFunctions and Mesh option values based on the region in the first argument of RegionPlot. – kglr Nov 6 '19 at 13:27