5
$\begingroup$

I have a region defined like in this question:

circle = Disk[{4.5, 3}, 0.5];
pin = Rectangle[{4, 0}, {5, 3}];
square = Rectangle[{0, 0}, {9, 9}];
region = RegionDifference[square, RegionUnion[circle, pin]];

RegionPlot[region] gives:

regionplot

Now I want to zoom into a semicircular opening. I attempt it like this:

RegionPlot[region,{x,3,6},{y,2,6}]

This doesn't work and gives an error:

RegionDifference[Rectangle[{0,0},{9,9}],RegionUnion[Disk[{4.5,3},0.5],\ Rectangle[{4,0},{5,3}]]] should be a Boolean combination of \ equations, inequalities, and Element statements

What do I do to solve this?

$\endgroup$
5
$\begingroup$

RegionPlot appears to be built with implicit regions in mind. To make it work you could use Element:

RegionPlot[Element[{x, y}, region], {x, 3, 6}, {y, 2, 6}]

Mathematica graphics

But for zooming in, PlotRange also comes to mind. This requires no trickery:

RegionPlot[region, PlotRange -> {{3, 6}, {2, 6}}]

Mathematica graphics

$\endgroup$
4
$\begingroup$

You can intersect your region with a rectangle representing the zoom-in area.

zoomInRect = Rectangle[{3, 2}, {6, 6}];
zoomInView = RegionIntersection[region, zoomInRect];
RegionPlot[zoomInView]

zoom_in

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.