pgf-tikz/pgfplots

`\thisrow` throws error when used with `read comma as period`

Opened this issue · 1 comments

From https://tex.stackexchange.com/q/647366

When table is read from file and /pgf/number format/read comma as period is turned on, commands \thisrow and \thisrowno used in y expr=<math expr> will throw errors.

I find only the math function form thisrow("y") is usable.

\begin{filecontents}[noheader,force]{data-comma.txt}
x y
1 1,0
2 2,0
3 5,0
\end{filecontents}
\begin{filecontents}[noheader,force]{data-period.txt}
x y
1 1.0
2 2.0
3 5.0
\end{filecontents}

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}
\begin{tikzpicture}
  \begin{axis}
    \addplot table[
      /pgf/number format/read comma as period,
      y expr={thisrow("y")+1},
%      y expr={\thisrow{y}+1},   % not working
%      y expr={\thisrowno{1}+1}, % not working
    ] {data-comma.txt};

    \addplot table[y expr=\thisrow{y}+2] {data-period.txt};
  \end{axis}
\end{tikzpicture}
\end{document}
awerh commented

Seams to be, that "read comma as period" is ignored when the data is captures with \thisrow... .