Extra edges added in RegionPlot [closed]

I want to generate figures of regions bounded by pairs of parallel lines. I'm using RegionPlot to do this, but my figures are showing these truncated corners that do not correspond to the regions I'm trying to define. Here is a very basic example:

RegionPlot[-1 < x + y < 1 && -1.5 < x - y < 1.5, {x, -3, 3}, {y, -3, 3}]


Obviously the region defined by these inequalities is a rectangle. But my output is this:

As you can see, it has these slightly truncated corners. They are sometimes more drastic in other examples of regions that should be parallelograms (are bounded by two pairs of parallel lines).

Is there something wrong with my syntax? Is this a glitch? How do I fix it?

closed as off-topic by Bob Hanlon, rhermans, garej, MarcoB, J. M. will be back soon♦Sep 26 '17 at 2:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, rhermans, garej, MarcoB, J. M. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

• Try PlotPoints->100. You need to look at the options associated with the commands. In this case, the more points you plot, the closer you get to an exact solution. – bill s Sep 25 '17 at 1:51
• @bills Thanks, yes of course I've been looking at the options associated with the commands but it's not always obvious which is the appropriate one, hence seeking help on this forum! – j0equ1nn Sep 25 '17 at 1:57
• RegionPlot[-1 < x + y < 1 && -3/2 < x - y < 3/2, {x, -3, 3}, {y, -3, 3}, MaxRecursion -> 5] – Bob Hanlon Sep 25 '17 at 2:08
• Information that is easily found in the documentation isn't likely to be of much use to future visitors, so we just reply in the comments. Your question is likely to be closed - please don't be offended, but do try to explore the documentation in future before posting. – bill s Sep 25 '17 at 2:58
• Interestingly, I get a nice rectangle when I reduce the plot range, as RegionPlot[-1 < x + y < 1 && -1.5 < x - y < 1.5, {x, -1.5, 1.5}, {y, -1.5, 1.5}]. Szabolcs' answer in other words is that Mathematica doesn't analytically determine that your region is a rectangle. It just samples points on a grid and then draws a bounding box. When your plot range is large compared to your region, it doesn't capture the small features such as sharp corners. I don't have a catch-all solution in general. Sometimes trying an alternative method gives results as good as increasing... – LLlAMnYP Sep 25 '17 at 9:01

RegionPlot samples the plot region on a regular grid, then refines that grid where necessary to improve precision. You can see the grid using the Mesh -> All option.

This method is not good at accurately mapping sharp corners, but you can always increase PlotPoints or MaxRecursion to get a better result.

If you define the region in terms of ImplicitRegion, you can use DiscretizeRegion instead, which has better methods for sharp corners.

reg = ImplicitRegion[-1 < x + y < 1 && -1.5 < x - y < 1.5, {x, y}];

BoundaryDiscretizeRegion[
reg,
Method -> #
] & /@ {"RegionPlot", "Continuation"}