# Ternary: Inconsistencies with regions at corners?

I am noticing that regions are not correctly displayed and often have incorrect corners.

Example 1

Clear[ternary, reg, sol, tern];
ternary[{p1_, p2_, p3_}] = {p1 + 1/2 p2, Sqrt[3]/2 p2};
reg[a_] := ImplicitRegion[{x/z >= 1 - 2*a, {x, y, z, a} >= 0, x + y + z == 1}, {x, y, z}];
sol[a_] := {x, y, z} /. FindInstance[{x, y, z} \[Element] reg[a], {x, y, z}, 1];
tern[a_] := TernaryListPlot[sol[a], Prolog -> {LightBlue, DiscretizeRegion[TransformedRegion[reg[a], ternary]]}, PlotStyle -> Transparent]
tern[0.1]
tern[0.2]
tern[0.3]


Only the second output is correct - the other top corners are incorrect.

Example 2

    Clear[ternary, sol, reg, tern];
ternary[{p1_, p2_, p3_}] = {p1 + 1/2 p2, Sqrt[3]/2 p2};
reg := ImplicitRegion[{y >= 0.5, {x, y, z} >= 0, x + y + z == 1}, {x, y, z}];
sol := {x, y, z} /. FindInstance[{x, y, z} \[Element] reg, {x, y, z}, 1];
tern = TernaryListPlot[sol, Prolog -> {LightBlue, DiscretizeRegion[TransformedRegion[reg, ternary]]}, PlotStyle -> Transparent]


• This is not a problem of TernaryListPlot but of ploting (discretizing) the region. You can make a finer discretization with DiscretizeRegion[..., MaxCellMeasure -> 1/1000]. Sep 21, 2022 at 19:06
• Great, it worked - thank you!
– Tom
Sep 21, 2022 at 19:12

• Since the region is the part of simplex (flat plane),we can try to use MaxCellMeasure -> ∞ in some cases.

• I final found out that we need not define ternary[{p1_, p2_, p3_}] = {p1 + 1/2 p2, Sqrt[3]/2 p2}; as in my previous answer since TernaryListPlot directly support ternary elments. Here we disretize the 3D reg and extract its 2-dimensinal embeded 3D polygons by polygons=MeshPrimitives[dreg, 2].

• Use Simplex and HalfSpace can improve the result.

Clear[reg, sol, dreg,polygons];
reg = ImplicitRegion[{y >= 0.5, {x, y, z} >= 0, x + y + z == 1}, {x,
y, z}];
sol = {x, y, z} /.
FindInstance[{x, y, z} ∈ reg, {x, y, z}, 10];
dreg = DiscretizeRegion[reg, {{0, 1}, {0, 1}, {0, 1}},
MaxCellMeasure -> .001];
polygons = MeshPrimitives[dreg, 2];
TernaryListPlot[sol, Prolog -> {LightBlue, polygons},
PlotStyle -> Red]


Clear[reg, sol, dreg, polygons];
a = .3;
reg = RegionIntersection[Simplex[IdentityMatrix[3]],
HalfSpace[-{1, 0, -(1 - 2*a)}, 0]];
dreg = DiscretizeRegion[reg, MaxCellMeasure -> ∞];
polygons = MeshPrimitives[dreg, 2];
sol = {x, y, z} /.
FindInstance[{x, y, z} ∈ reg, {x, y, z}, 10];
polygons = MeshPrimitives[dreg, 2];
TernaryListPlot[sol, Prolog -> {LightBlue, polygons},
PlotStyle -> Red]