5
$\begingroup$

I'd like to create a graphic that looks like the following using RegionPlot with Mesh:

enter image description here

I have three different plots and would like combine them with Show:

abc = RegionPlot[1 > 0, {a, 0.001, 0.999}, {b, 0.01, 0.99}, AxesOrigin -> {0, 0}, PlotRange -> {{0, 1}, {0, 1}}, Frame -> True, RotateLabel -> False, PlotStyle -> Opacity[0, White], BoundaryStyle -> {Opacity[0, Black], Thickness[0.004]}, Mesh -> 30, MeshFunctions -> {-#1 - #2 &}, MeshStyle -> GrayLevel[0.75], AspectRatio -> 1] 

enter image description here

def = RegionPlot[-(a - 1.5)^2 + 1 < b, {a, 0.01, 0.99}, {b, 0.001,0.999}, AxesOrigin -> {0, 0}, PlotRange -> {{0, 1}, {0, 1}}, Frame -> True, RotateLabel -> False, BaseStyle -> FontSize -> 12, PlotStyle -> White, BoundaryStyle -> {Opacity[0, Black], Thickness[0.004]}, Mesh -> None, AspectRatio -> 1] Show[abc,def] 

enter image description here

ghi = RegionPlot[-(6*a - 3)^2 + 0.75 < b, {a, 0.01, 0.99}, {b, 0.001,0.999}, AxesOrigin -> {0, 0}, PlotRange -> {{0, 1}, {0, 1}}, Frame -> True, RotateLabel -> False, BaseStyle -> FontSize -> 12, PlotStyle -> White, BoundaryStyle -> {Opacity[0, Black], Thickness[0.004]}, Mesh -> None, MeshFunctions -> {-#1 - #2 &}, AspectRatio -> 1] Show[abc,ghi] 

enter image description here

Then I get with Show[abc, def, ghi]

enter image description here

Is there a way to remove the white-colored regions, i.e., let them be transparent, such that I can simply overlay the two plots? Simply changing their color to Transparent results in the original mesh again.

Thanks a lot in advance!

$\endgroup$

3 Answers 3

6
$\begingroup$
RegionPlot[Not[1 -(a - 3/2)^2 < b && 3/4 -(6 a - 3)^2 < b], {a, 0, 1}, {b, 0, 1}, PlotStyle -> None, BoundaryStyle -> None, Mesh -> 30, MeshFunctions -> {-#1 - #2 &}, MeshStyle -> GrayLevel[3/4]] 

Mathematica graphics

$\endgroup$
3
  • 2
    $\begingroup$ @Paul, Using Mesh -> {Subdivide[-2, 0, 31]} will give a mesh that matches abc, in case that matters. $\endgroup$ Commented Jul 9, 2015 at 17:07
  • $\begingroup$ @Michael E2: Amazing! In fact, that is exactly what I was originally looking for. Since with Mesh->30 the mesh changes as soon as my plot changes, I tried the described workaround with Plotstyle->White and Mesh->None. Perfect, thanks a lot!! $\endgroup$ Commented Jul 9, 2015 at 17:49
  • $\begingroup$ I'd also like to thank the other solution approaches! I wasn't aware of the proposed compound formulation, which makes it more compact and leads to the desired solution! Thanks!! $\endgroup$ Commented Jul 9, 2015 at 18:04
4
$\begingroup$

Taking the request for post-processing at face value we might do something like:

intr = RegionIntersection @@ DiscretizeGraphics /@ {def, ghi} 

enter image description here

poly = Cases[Normal @ Region`MeshRegionToGraphics @ intr, _Polygon, -1]; Show[abc, Graphics[{White, poly}]] 

enter image description here

$\endgroup$
1
  • $\begingroup$ Great, this is also very nice one! Thanks a lot!! $\endgroup$ Commented Jul 9, 2015 at 18:10
3
$\begingroup$

I hope that I am understanding your goal correctly. I would suggest using a single compound condition in RegionPlot, rathen than trying to combine graphics afterwards:

RegionPlot[ Not[-(a - 1.5)^2 + 1 < b && -(6*a - 3)^2 + 0.75 < b], {a, 0, 1}, {b, 0, 1}, PlotRange -> {0, 1}, PlotRangePadding -> None, AspectRatio -> 1, Frame -> True, FrameStyle -> FontSize -> 12, PlotStyle -> White, BoundaryStyle -> None, Mesh -> 30, MeshFunctions -> {-#1 - #2 &}, MeshStyle -> GrayLevel[0.75] ] 

Mathematica graphics

Please note that I have also modified some options to your plot to simplify them a bit.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.