I am following on one of my previous questions regarding the use of foreach loop in tikzpicture:
Here is a simple description with a code that works but with all markers colored in red:
\documentclass{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.18}
\begin{document}
\newcommand{\Table}{
\begin{tikzpicture}
\begin{axis}
\foreach \A / \B/ \C in {1/100/green, 2/200/red}
\addplot [
mark=diamond*,
color=red
]
coordinates {(\B, \A)};
\end{axis}
\end{tikzpicture}
}
\Table
\end{document}
In my case, i would like to make the color a variable in the foreach loop. I tried to adapt a methods that was suggested succesfully for marker label in my previous question. So i changed color=red
for
visualization depends on={value \C\as\myC},
color={\myC}
But in that case it does not compile and return a 'undefined control sequence' error. I would be interested to understand the reason behin such problem, and possible way to fix it.
Thanks in advance.