I could use some help. I am trying to color a bar chart assigning different colors using a foreach loop and pgfmathresult to get a color gradient. Here is a minimal example:
\documentclass{minimal}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableread{
Label 1 2 3
R1 3 2 1
R2 2 1 3
R3 1 2 3
}\testdata
\begin{tikzpicture}
\begin{axis}[ybar stacked, ymin=0, xtick=data, xticklabels from table={\testdata}{Label}]
\foreach \s in {1,...,3}{
\pgfmathparse{\s*30}
\addplot [fill=blue!\pgfmathresult!green] table [y=\s, meta=Label,x expr=\coordindex] {\testdata};
}
\end{axis}
\end{tikzpicture}
\end{document}
But the result I obtain has no gradient
Jet when I run almost the same code (without pgfplot):
\begin{tikzpicture}
\foreach \s in {1,...,3} {
\pgfmathparse{(\s*30)}
\draw[blue!\pgfmathresult!green, thick]
(0,\s * .2) -- (1,\s * .2)
;
}
\end{tikzpicture}
Has anyone an idea whats going wrong here and how to fix it?