Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

\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.

share|improve this answer
    
Thanks, this works. :) So much parameters and options in pgfplots, it's very confusing... –  Foo Bar Nov 13 '12 at 20:17
2  
@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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.