How can I say sum multiple columns of a table using y expr while also using \foreach
I was hoping something like this would work but apparently it requires some sort of expression evaluation I can't get to work:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\foreach \y in {1,3,5,7}
\addplot table[x=Foo, y expr={\thisrowno{\y} + \thisrowno{\y+1}}] {data.csv};
\end{axis}
\end{tikzpicture}
\end{document}
The data:
Foo John John_a Paul Paul_a George George_a Ringo Ringo_a
1 0.0 37.0 0.00 9.00 0.0 4.0 0.0 12.80
2 16.0 5.0 4.0 1.0 0.6 2.80 0.0 12.80
4 8.0 5.0 2.0 1.0 0.3 2.8 0.0 12.80
8 4.0 5.0 1.0 1.0 0.4 2.8 0.0 12.80
16 2.0 5.0 1.2 1.0 0.4 2.8 0.0 12.80
32 1.0 5.0 1.3 1.0 0.5 2.8 0.0 12.80


data.csvfile, so your code can be compiled? – jub0bs Jan 09 '14 at 15:15