# tikz pgfplots ternary diagram, density map

I am plotting points in a ternary diagram using pgfplots and the ternary axis environment. Each point does posses a 4th value (besides the 3 that are the coordinates). At the moment I am stating this 4th value as a node next to each plotted point. This comes with the problem that the minima/maxima of this value is not easy to spot as well as it is hard to read general trends. Also nodes can't reach outside of the ternary axis which leads to inconsistency with labeling points close to the axis.

I would like to have the points coloured according to their value (i.e. a value of 5 would be blue, 7.5 would be yellow and 10 would be red) this should be done gradually of course. Ideally I would like to have a fully coloured map with the space between the points interpolated.

Does anyone know of a way or at least a workaround to have the points coloured according to their 4th value?

Image:

LaTeX source:

http://depositfiles.com/files/5gaazfu5q

-
Welcome to TeX.sx! No neeed to add thanks, the preferred way to indicate appreciation is to upvote answers. Could you also provide a Minimal Working Example (MWE) of your problem. –  Peter Jansson Jan 26 at 21:39
Also check the manual page 89 for nodes near coords example with colored markers. –  percusse Jan 26 at 21:39
page 89 brought me close to the solution. The only thing missing now would be some sort of legend that shows which colour belongs to which number –  eject Jan 26 at 22:58
Also look for the colormap placement section of the manual. –  percusse Jan 26 at 23:47
@eject Could you please answer your own question providing the final code which solved your issue? You can even accept it. –  JLDiaz Jan 27 at 0:09
show 1 more comment

a working example:

\documentclass [12pt]{scrartcl}
\usepackage [utf8x] {inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usepgfplotslibrary{ternary, units}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.pathmorphing, pgfplots.ternary, pgfplots.units}

\begin{document}
\begin{tikzpicture}
\begin{ternaryaxis}[colorbar, colormap/jet,
xmin=0,
xmax=100,
ymin=0,
ymax=100,
zmin=0,
zmax=100,
xlabel=component1,
ylabel=component2,
zlabel=component3,
label style={sloped},
minor tick num=3,
grid=both,
]

point meta=\thisrow{myvalue}, %  uses ’point meta’ as color data.
nodes near coords*={\tiny{\pgfmathprintnumber\myvalue}}, % does what it says
visualization depends on={\thisrow{myvalue} \as \myvalue} %defines visualization dependency
] table {

x       y       z       myvalue
10      0       90      7.1
40      0       60      9.2
50      0       50      9.8
70      0       30      8.5
20      30      50      5.5
20      20      40      5
20      50      30      4.8
30      40      30      6.3
30      20      50      7.1
40      20      40      7.8
40      30      30      7.4
40      40      20      6.9
40      50      10      6.7
10      10      80      4.7
10      20      70      4.2
10      30      60      3.7
10      40      50      3.5
10      50      40      3.2
10      70      20      4.8
10      80      10      5.2
50      30      20      7.8
50      20      30      8.3
60      10      30      9
70      20      10      9.2
80      10      10      9.9
20      10      70      6.2
40      60      0       6.6
70      30      0       9.3
50      10      40      8.9
20      20      60      5.9
};

\end{ternaryaxis}
\end{tikzpicture}
\end{document}


Result:

-
+1 for self-answering with the solution. I added the (nice) image. –  JLDiaz Jan 27 at 1:33
Good solution! Note that you do not even need the "visualization dependency" in your current solution - its value is available as \pgfplotspointmeta anyway (i.e. your \myvalue is the same as \pgfplotspointmeta). –  Christian Feuersänger Jan 27 at 8:12