I am trying to improve my workflow in LaTeX using pgfplotstable to also include automatic error calculation.
Right now, when I run a simulation, I save the output to a csv table, which I load into LaTeX using pgfplotstable, e.g. something like
\documentclass{standalone}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=newest}
\begin{document}
\pgfplotstableread{
x y
1 1.0
2 2.0
3 3.0
}\sim
\begin{tikzpicture}
\begin{axis}
\addplot table[x=x, y=y]\sim;
\end{axis}
\end{tikzpicture}
\end{document}
However, now I want to compare the result of this simulation to some reference solution (or another method). So is it possible to find the difference between the y-values of two different tables?
I imagine that something like this, should be possble
\documentclass{standalone}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=newest}
\begin{document}
\pgfplotstableread{
x y
1 1.0
2 2.0
3 3.0
}\sim
\pgfplotstableread{
x y
1 1.5
2 1.5
3 2.0
}\ref
\begin{tikzpicture}
\begin{axis}
\addplot table[x=x, y expr=\thisrow{y}{\sim}-\thisrow{y}{\ref}]; %Not working
\end{axis}
\end{tikzpicture}
\end{document}
Though note that y expr=\thisrow{y}{\sim}-\thisrow{y}{\ref} does not work as the usage of \thisrow is wrong, the second input is used for output and not input, it is merely to illustrate the idea.
