# Removing unwanted appearance of underlying mesh

Let us first define two positive definite matrices:

M1 = {{2, -6}, {4, 8}};
M2 = {{2, 3}, {4, 8}};


then set two points p1={-1,-1} and p2={1,1}. Finally we define an anisotropic distance function, namely:

d[q1_, q2_, M_] := Sqrt[(q1 - q2).M.(q1 - q2)]


When trying to plot the anisotropic Voronoi cells as follows:

Show[
Graphics[Point[{p1, p2}]],
RegionPlot[
{
d[{x, y}, p1, M1] < d[{x, y}, p2, M2],
d[{x, y}, p1, M1] > d[{x, y}, p2, M2]
},
{x, -4, 4}, {y, -4, 4}
]
]


I obtain the following image:

My question is: How can I get rid of the underlying mesh, which is visible in this example?

Two remarks:

1. Removing the points' plotting also removes the mesh.
2. Adding something like Mesh->None to the RegionPlot doesn't help.

## Edit:

It seems this problem is specific to Mac OS X. Here is the Options[RegionPlot] output:

{AlignmentPoint -> Center, AspectRatio -> 1, Axes -> False,
AxesLabel -> None, AxesOrigin -> Automatic, AxesStyle -> {},
Background -> None, BaselinePosition -> Automatic, BaseStyle -> {},
BoundaryStyle -> Automatic, ColorFunction -> Automatic,
ColorFunctionScaling -> True, ColorOutput -> Automatic,
ContentSelectable -> Automatic, CoordinatesToolOptions -> Automatic,
DisplayFunction :> $DisplayFunction, Epilog -> {}, Evaluated -> Automatic, EvaluationMonitor -> None, FormatType :> TraditionalForm, Frame -> True, FrameLabel -> None, FrameStyle -> {}, FrameTicks -> Automatic, FrameTicksStyle -> {}, GridLines -> None, GridLinesStyle -> {}, ImageMargins -> 0., ImagePadding -> All, ImageSize -> Automatic, ImageSizeRaw -> Automatic, LabelStyle -> {}, MaxRecursion -> Automatic, Mesh -> None, MeshFunctions -> {#1 &, #2 &}, MeshShading -> None, MeshStyle -> Automatic, Method -> Automatic, PerformanceGoal :>$PerformanceGoal, PlotLabel -> None,
PlotPoints -> Automatic, PlotRange -> Full,
PlotRangeClipping -> True, PlotRangePadding -> Automatic,
PlotRegion -> Automatic, PlotStyle -> Automatic,
PreserveImageOptions -> Automatic, Prolog -> {}, RotateLabel -> True,
TextureCoordinateFunction -> Automatic,
TextureCoordinateScaling -> Automatic, Ticks -> Automatic,
TicksStyle -> {}, WorkingPrecision -> MachinePrecision}

• This mesh should not appear by default. Does it appear in other types of graphics, like DensityPlot for example? What OS and Mathematica version? Feb 6, 2012 at 12:11
• No mesh when I plot it on M 7.0.1.0, XP SP3 Feb 6, 2012 at 12:13
• Just in case: could you please include the result of Options[RegionPlot] in your question? Feb 6, 2012 at 12:13
• I get a mesh in Mathematica v8.0.4 on OS X Lion Feb 6, 2012 at 12:38
• I get a mesh on 8.0.4 on OS X Snow Leopard. Feb 6, 2012 at 21:33

You are combining the images in the form

Show[Graphics[simplePrimitives], complicatedRegionPlot]


The options in the resulting figure are inherited from the first term, namely Graphics[simplePrimitives]. This does not include the "TransparentPolygonMesh" -> True generated by RegionPlot. You see the mesh as a result. If you combine things as follows:

Show[complicatedRegionPlot, Graphics[simplePrimitives]]


Then the resulting image will have the standard RegionPlot options and you'll no longer see the mesh.

I think the preferred way to do this, however, is to use Epilog, as in J.M.'s response.

• +1 for explaining why the mesh shows up in addition to fixing the problem Feb 6, 2012 at 13:44
• What OS are you using? I see no mesh at all. I wonder if the mesh is a Mac-only thing. Feb 6, 2012 at 14:04
• The simplest solution in some sense although the others work as well.
– Dror
Feb 6, 2012 at 14:49
• @Szabolcs I used V8.0.4 on Mac OS X. I can confirm that V8.0.0 on Windows running in Virtual Machine displays no Mesh. That's odd. The inconsistency seems to be a bug to me. Feb 6, 2012 at 15:21
• Just a guess: Maybe graphics rendering is done differently on different platforms (or different modes are enabled by default), and some idiosyncrasy of the Mac rendering forced the developers to use this workaround. I noticed that @Heike's screenshot is not antialiased. Antialiasing is missing on Windows only when hardware accelerated rendering is used (this mode is automatically turned on e.g. if a Polygon with different VertexColors is included, but it's usually off) Feb 6, 2012 at 15:42

You could use the (undocumented) option Method -> {"TransparentPolygonMesh" -> True} for this, e.g.

Show[Graphics[Point[{p1, p2}]],
RegionPlot[{d[{x, y}, p1, M1] < d[{x, y}, p2, M2],
d[{x, y}, p1, M1] > d[{x, y}, p2, M2]}, {x, -4, 4}, {y, -4, 4}],
Method -> {"TransparentPolygonMesh" -> True}]


which produce

• Method -> {"TransparentPolygonMesh" -> True} is not documented, for Graphics, in Mathematica 10.3.1 (and possibly in 10.3). Dec 24, 2015 at 19:53

RegionPlot[{d[{x, y}, p1, M1] < d[{x, y}, p2, M2], d[{x, y}, p1, M1] > d[{x, y}, p2, M2]}, {x, -4, 4}, {y, -4, 4}, Epilog -> Point[{p1, p2}]] seems to do what you want:

• On that note: if you just want to tack on simple graphics primitives (e.g. Point[], Line[]) to your plots, the use of either the Prolog or Epilog options looks slightly neater than using Show[]`. Feb 6, 2012 at 13:58