# Getting additional control over MaxRecursion/PlotPoints

I'm occasionally in a position where I need to compute a RegionPlot with some small area of the plot being computationally much more expensive then the rest of the plot. Now the easiest solution is to crank up MaxRecursion and PlotPoints for the entire plot. Unfortunately this also wastes a lot of time since then this setting is applied for the entire plot. Is there a way to specify these settings separately for different regions in a plot?

Right now my solution is just to compute separate plots and then patch them together, however this is sub-optimal since then I need to manually get rid of boundaries and its a mess.

A minimal example where this would be useful would be:

RegionPlot[Sin[E^(x + y)] > 0.2, {x, 0, 2.5}, {y, 0, 2.5}]

The top right corner of the plot requires higher resolution to get it to look reasonable, but this is not necessary anywhere else in the plot.

There are many different possibilities. I will specify, for example, such code

p1 = RegionPlot[
Sin[E^(x + y)] > If[1.7 < x < 2.5 && 1.7 < y < 2.5, 2, .2], {x, 0,
2.5}, {y, 0, 2.5}, PlotPoints -> 60];

p2 = RegionPlot[Sin[E^(x + y)] > 0.2, {x, 1.7, 2.5}, {y, 1.7, 2.5},
PlotPoints -> 60, PlotStyle -> Directive[Opacity[.5], Red]];

Show[p1, p2]


If you don't like borders, you can delete them

p1 = RegionPlot[
Sin[E^(x + y)] > If[1.7 < x < 2.5 && 1.7 < y < 2.5, 2, .2], {x, 0,
2.5}, {y, 0, 2.5}, PlotPoints -> 60, BoundaryStyle -> None];

p2 = RegionPlot[Sin[E^(x + y)] > 0.2, {x, 1.7, 2.5}, {y, 1.7, 2.5},
PlotPoints -> 60, BoundaryStyle -> None];

Show[p1, p2]


• Thanks for the response. Indeed this is precisely my current solution however it can be get very clunky as combining the two plots seamlessly (without showing the boundaries between the contours) is a big nuisance unless you use regions Opacity[1]. In other words I don't want to the viewer to plot to actually differentiate between the two regions visually. – JeffDror Oct 11 '18 at 11:12
• @JeffDror, if you don't like borders, you can delete them. – Alex Trounev Oct 11 '18 at 13:19
• Yes, I'm aware. I was hoping to keep the borders in general, just not between different regions where I adjusted the numerical resolution. Maybe I'm asking for too much... – JeffDror Oct 11 '18 at 14:03

You could try using DiscretizeRegion instead:

reg = ImplicitRegion[Sin[E^(x+y)]>0.2, {{x,0,2.5}, {y,0,2.5}}];

BoundaryDiscretizeRegion[reg, Frame->True]


• Hmm, is (Boundary)DiscretizeRegion[] smart enough to concentrate its effort in regions where more sampling is needed? If RegionPlot[] itself is not that smart... – J. M.'s technical difficulties Oct 11 '18 at 15:00