I am trying to plot a small dataset and a regression line for it.

Here is my MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{filecontents}

\begin{filecontents}{dtat.dat}
X Y
1 9
2 8
3 4
4 2
\end{filecontents}

\begin{document}

\begin{tikzpicture}
\begin{axis}
\addplot table [x=X,y={create col/linear regression={y=Y}}] {dtat.dat};
\end{axis}
\end{tikzpicture}

\end{document}


Though I believe my file accurately reflects the examples in the manual and online, I get the following error:

Package pgfplots Error: Sorry, could not retrieve column 'create col/linear r egression={y=Y}' from table 'dtat.dat'. Please check spelling (or introduce nam e aliases)..

The data plots accurately, but the regression line basically plots the x values (or line numbers?) against themselves and is clearly incorrect. Any help resolving this (probably simple user) error would be greatly appreciated.

In case it makes a difference, I am using TeX Live on Ubuntu and Linux Mint, which are both fully up to date). The version of pgfplots.sty is 1.2.2 from 2009/02/14. (Woefully outdated I'm guessing...?)

-

## closed as too localized by percusse, Tom Bombadil, Harish Kumar, Claudio Fiandrino, lockstepSep 9 '12 at 14:23

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to TeX.sx! It would be useful to know exactly what version of pgfplots you have: could you add \listfiles to your input, then in the log find the 'File List' and edit that into the question? –  Joseph Wright Sep 8 '12 at 14:36
Ah...version 1.2.2. And I see that linear regression was added in 1.5. Guess its time to work out how to update a sty file independent of the repositories. Thanks. A simple issue I didn't think to check. –  cuz Sep 8 '12 at 14:52
Upgraded to TeXLive 2012 and updated the pgfplots package using these instructions. Works great now. Thanks again for solving the first problem I couldn't work out on my from the forums. –  cuz Sep 8 '12 at 15:45