I would like to color every dot red where the corresponding second column of the data is set to 1.
This is my minimal working example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableread[header=false, col sep=comma]{
Label 1,1,0.0443
Label 2,0,0.0371
Label 3,1,0.0191
Label 4,0,0.0638
Label 5,0,0.0149
}\data
\begin{figure}
\begin{tikzpicture}
\centering
\begin{axis}[
axis x line=bottom,
axis y line=left,
xmin=0,
width=10cm,
ymajorgrids,
bar width=2ex, y=3ex,
enlarge y limits={abs=0.75},
ytick=data,
scaled ticks=false,
yticklabels from table={\data}{0},
xticklabel style={/pgf/number format/fixed},
]
\addplot[only marks] table [
y expr=-\coordindex,
x index=2
]{\data};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
The first and the third dot should be red as defined in the data.
I have not yet found any approach to defining colors (or shape!) based on the data. Is it possible with TikZ/PGFPlots?


