Message Boards Message Boards

3 Replies
0 Total Likes
View groups...
Share this post:

Avoid issue while using RegionPlot?

Posted 5 years ago

My simple code

o1 = Rectangle[{0, 0}, {3, 2}];
o2 = Disk[{3, 1}, 0.5];
o = RegionDifference[o1, o2];
RegionPlot[o, PlotRange -> Full]

Produces this strange output. It seems to me, that the RegionPlot output is not OK, beacuse the shape of the region is different. Function DiscretizeRegion works as expected.. Screenshot

POSTED BY: Tomáš Hruš
3 Replies

To visualize it you can simply do it like so:

POSTED BY: Henrik Schachner
Posted 5 years ago

My mistake! The problem is only in the PlotRange parameter. In former version of Mathematica, teh full region was visible vithout explicit PlotRange specification, now it is necessary to specify propper PlotRange. Thanks!

POSTED BY: Tomáš Hruš

Try with an explicit PlotRange:

 RegionDifference[Rectangle[{0, 0}, {3, 2}], Disk[{3, 1}, 1/2]], 
 PlotRange -> {{-1, 4}, {-1, 4}}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract