4

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 ?

1 Answer 1

5

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]
\addplot3[
    patch,
    shader=interp,
    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}

enter image description here

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.

4
  • 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. Commented Nov 9, 2015 at 6:48
  • Ok. As mentioned above: "Regarding the three-d visualization: there is no builtin support for such axes." This is the answer. Commented Nov 9, 2015 at 19:18
  • Sorry. I have read your answer too fast. Don't you think the figures I linked are made with pgfplots ? Commented Nov 10, 2015 at 6:25
  • 1
    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. Commented Nov 10, 2015 at 20:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .