# How to plot curves in ternary plot (triangular plot) [duplicate]

I need to plot the following curve in a triangular (ternary) plot: $$|x_{BB}-x_{AA}|=(\sigma_c-2x_{AB}+1)^{\gamma}, \qquad (1)$$ subjected to the condition (this condition must satisfy for a ternary plot) $$x_{AA}+x_{AB}+x_{BB}=1, \qquad (2)$$

where $\sigma_c$ is a positive constant, say 1, and $\gamma=0.35$.

My attempt is to express $x_{AB}$ in terms of the other two variables from the equation (2) and substitute the resulting expression in (1), then I obtain the following:

Abs[b - a] == (2 - 2 (1 - a - b))^0.35


Questions:

a) Is this expression equivalent to the equations (1) and (2)?

b) How do I plot the curve (1) subjected to (2) in a ternary form?

## marked as duplicate by bobthechemist, Kuba♦, Öskå, Karsten 7., gpapNov 21 '14 at 13:25

• – Szabolcs Nov 20 '14 at 18:52
• Indeed, I believe István Zachar's answer in particular would work perfectly for this question. – Rahul Nov 20 '14 at 18:57
• Your example seems to have no solutions, by the way. ( I think you need sc<1 .. ) – george2079 Nov 20 '14 at 19:32
• Try to leverage the power of ContourPlot3D. – Silvia Nov 22 '14 at 8:58

make use of ContourPlot to find solutions..

 dat = Table[ {#[[1]], #[[2]], 1 - #[[1]] - #[[2]]} & /@
Select[
Cases[ ContourPlot[
Abs[ b - a] == ( sig - 2 (1 - b - a ) + 1  )^.35 ,
{a, 0, 1}, {b, 0, 1}] ,
List[a_Real, b_Real] :> { a, b } ,
Infinity] , #[[1]] + #[[2]] <= 1 & ] ,
{sig, -1, 1, .25}];


then transform to a ternary figure:

 Graphics[{Line[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}, {0, 0}}],
Point[{#[[2]] + #[[3]]/2  , Sqrt[3]/2 #[[3]] } & /@ #] & /@  dat}]


Edit -- same thing preserving the lines form ContourPlot

 tercp[cp_Graphics] :=
Quiet@Cases[ Normal@First@Cases[cp, _GraphicsComplex, Infinity] ,
Line[x_] :> Line[{
1 - #[[1]] + #[[2]],
Sqrt[3] (1 - #[[1]] - #[[2]])}/2 & /@
Select[x, Total[#] <= 1 &] ], Infinity]

Graphics[{Line[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}, {0, 0}}],
{Dashed,
Table[ tercp [ ContourPlot[(1 - b - a) == ci , {a, 0, 1}, {b, 0, 1}] ],{ci, .1, .9, .1}],
Table[tercp [ ContourPlot[a == ci , {a, 0, 1}, {b, 0, 1}] ], {ci, .1, .9, .1}],
Table[ tercp [ ContourPlot[b == ci , {a, 0, 1}, {b, 0, 1}] ] , {ci, .1, .9, .1}]},
Table[ {Hue[RandomReal[]],
tercp [ ContourPlot[Abs[b - a] == (sig - 2 (1 - b - a) + 1)^.35,
{a, 0, 1}, {b, 0, 1}] ] }, {sig, -1, 1, .2}]}]