Message Boards Message Boards

0
|
4173 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
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]
DiscretizeRegion[o]

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:

Region[o]
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:

RegionPlot[
 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
Attachments
Remove
or Discard

Group Abstract Group Abstract