# pgfplots: \thisrowno{} is an undefined control sequence?

A lot of code about pgfplots I found (also here on tex.stack) was using \thisrowno{} to address specific rows of a table. All of these had no additional pakages loaded than I do in the following example. But I get the error that \thisrowno is an undefined control sequence. What am I missing and/or doing wrong?

\documentclass{article}

\usepackage{pgfplots}
\usepackage{filecontents}

\pgfplotsset{compat=newest}

\begin{filecontents}{data.dat}
0.0  1
0.1  23
0.2  4
0.3  35
\end{filecontents}

\begin{document}

\begin{tikzpicture}
\begin{axis}
\addplot table [x=\thisrowno{1}, y=\thisrowno{0}] {data.dat};
\end{axis}
\end{tikzpicture}

\end{document}

-
add comment

## 1 Answer

\thisrowno{0} is used to access the content of a certain column in the context of an expression.

In this case, however, you merely want to specify which column to use for x and y, so you'd use x index=1, y index=0. If your columns had proper names, you could use x=<column name>, y=<column name>. If you really want to use the \thisrowno syntax, you could use x expr=\thisrowno{1}, y expr=\thisrowno{0}.

However, typically you'd use x expr to process the data, for example using x expr=\thisrowno{0} + \thisrowno{1} * \coordindex.

-
Thanks, this works. :) So much parameters and options in pgfplots, it's very confusing... –  Foo Bar Nov 13 '12 at 20:17
@FooBar: It is at first, but stick with it, it'll pay off! Very soon, it'll come very naturally. –  Jake Nov 13 '12 at 20:21
+1 for your comment suggesting to stick with it :-) –  Harish Kumar Nov 14 '12 at 0:09
add comment