I'd like to produce a scatter plot from a data file. The data file could look like this:
x y color myvalue
0.5 0.2 1 test
0.2 0.1 2 uniform
I'd like to add the string data in column myvalue to the nodes, but still have the option to colour the marks. I tried two things recommended in the manual:
\begin{tikzpicture}
\begin{axis}[% scatter/use mapped color={draw=black,fill=mapped color},
enlargelimits=0.2]
\addplot[scatter, mark=*,only marks,
scatter src=explicit symbolic,
nodes near coords,]
table [x=x, y=y, meta=myvalue] {tab.tbl};
\end{axis}
\end{tikzpicture}
This allows me to put the labels to the marker in the plot.
But I don't know how to add colours. My second attempt was to use the colour for the point meta data (manual page 88), but then I couldn't add text (it would only accept numbers in the code below):
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot[scatter, mark=*,only marks,
scatter src=explicit symbolic,
% we use ’point meta’ as color data...
point meta=\thisrow{color},
% ... therefore, we can’t use it as argument for nodes near coords ..
nodes near coords*={\myvalue},
% ... which requires to define a visualization dependency:
visualization depends on={\thisrow{myvalue} \as \myvalue},
]
table [x=x, y=y, meta=myvalue] {tab.tbl};
\end{axis}
\end{tikzpicture}
How can I have both?
