# Draw a surface on a ternary diagram with pgfplots

I'd like to draw a surface on a ternary diagram.

Until now, I can plot density maps on a ternary diagram (cf. density map). But I would like to replace the density map by a surface, like on figs a and b.

Is it possible to do it with tikz - pgfplots - ternaryaxis - tikz-3dplot ?

Regarding the two-dimensional ternary axes in your screen shot: yes, using its patch plots:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usepgfplotslibrary{ternary}

\begin{document}
\begin{tikzpicture}
\begin{ternaryaxis}[
axis on top,
xlabel=x,ylabel=y,zlabel=z,
colorbar]
patch,
point meta=\thisrow{C}
] table{
X Y Z C
0 0 1  100
1 0 0  0
0.5 0.5 0  0

0.5 0.5 0  0
0 1 0  20
0 0 1 100
};
\end{ternaryaxis}
\end{tikzpicture}
\end{document}


The plot handler expects a series of patches, per default using patch type=triangle. In my case, I provided two triangles, and provided the color data in column C of the input table.

All other plot handlers should work as well, even surf which expects a matrix of input values.

Regarding the three-d visualization: there is no builtin support for such axes.

• Even with a surf as an argument of the addplot3 command, the figure is still 2D, like fig [c and d] (journals.aps.org/prb/article/10.1103/PhysRevB.91.024108/figures/…) , but I want to draw figures like fig a and b. – Jérôme Dequeker Nov 9 '15 at 6:48
• Ok. As mentioned above: "Regarding the three-d visualization: there is no builtin support for such axes." This is the answer. – Christian Feuersänger Nov 9 '15 at 19:18
• Sorry. I have read your answer too fast. Don't you think the figures I linked are made with pgfplots ? – Jérôme Dequeker Nov 10 '15 at 6:25
• No problem! And yes, I am quite sure that the linked figures are not made with pgfplots. If they were, I would happily think about ways to incorporate their solution into pgfplots. – Christian Feuersänger Nov 10 '15 at 20:16