I want to colour the markers of a scatter3 plot in specified colours with rgb values. I tried it before in the following way:
\documentclass[]{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\centering
\begin{axis}[
view={100}{35},
width=255pt,
height=255pt,
z buffer=sort,
xlabel={$R$},
ylabel={$G$},
zlabel={$B$},
point meta=explicit,colormap/bluered,
scatter/use mapped color={ball color=mapped color},
]
\addplot3[only marks,scatter,mark size=2.5,
scatter/classes= {0={mark=ball, }}]
table[x=R,y=G,z=B,meta=C] {Scatterplot.txt};
\end{axis}
\end{tikzpicture}
\caption{Caption}
\label{label}
\end{figure}
\end{document}
In this try the data in Scatterplot.txt was divide in the following way:
R G B C
0.68235 0.67843 0.44314 1
0.68235 0.67451 0.45098 1
0.68235 0.67059 0.4549 2
0.67843 0.66667 0.4549 5
0.68235 0.67451 0.45882 4
0.68235 0.68235 0.46275 3
0.6902 0.69412 0.47451 2
It plotted the scatter plot like I wanted. The dots were in the colour cube and had 5 different colours. Those colours were just the ones defined by a predefined colourmap.
The problem is now, that i want to have the marker in a colour specified by three columns in Scatterplot.txt.
The file Scatterplot.txt now looks like:
R G B RED GREEN BLUE
0.68235 0.67843 0.44314 0.7653 0.74446 0.33547
0.68235 0.67451 0.45098 0.7653 0.74446 0.33547
0.68235 0.67059 0.4549 0.7653 0.74446 0.33547
0.67843 0.66667 0.4549 0.7653 0.74446 0.33547
0.68235 0.67451 0.45882 0.7653 0.74446 0.33547
0.68235 0.68235 0.46275 0.7653 0.74446 0.33547
0.6902 0.69412 0.47451 0.7653 0.74446 0.33547
So instead of 4 columns with 3 coordinates and a single "colourvalue" I want to have the markers still at the coordinates of the first 3 columns, but coloured in the rgb value defined in the last 3 columns.
This is the first question I asked here and i hope that it is in the format how you normally do this here. If not please let me know so I can do it better next time.
Note, that i found the question
How to plot scatter points using pgfplots with color defined from table rgb values
which is similar to mine, but I was not able to make it work with a
addplot3
command.
addplotand not anaddplot3command. I tried to use the commands in the question you posted, but they didnt worked. – Killuah13 Nov 02 '16 at 23:38Scatterplot.txt. (This can also be dummy values.) – Stefan Pinnow Nov 03 '16 at 06:17\addplotcommand from http://tex.stackexchange.com/a/197560/95441 and append them to your\addplot3command works perfectly fine, when you deletemeta=Cfrom thetableoptions (because in the table there is no column named "C"). If you still need assistance please let us know what exactly isn't working. Do you get an error message or is the output not as you expect and if so, could you add a screenshot to the question and describe, what you mean should be different. – Stefan Pinnow Nov 03 '16 at 09:20