8

I am trying to use package pgfplots to read data from a file. This code is compiled on MacTeX 2014 under OSX 10.8.

Here is a snippet from the file in question: etotal.dat

T       Y
0.7618  0.060
0.7818  0.061
0.8618  0.062
0.8818  0.061
0.9018  0.061
0.9218  0.060
0.9418  0.058
0.9618  0.057
0.9818  0.055

And here is my MWE:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.10}

\begin{document}

\begin{tikzpicture}
\begin{axis}[%
    xmin=0,
    xmax=15.0,
    ymin=0,
    ymax=0.1,
    ]
\addplot table[x=T,y=Y]{etotal.dat};
\end{axis}
\end{tikzpicture}

\end{document}

This results in the error: Package pfgplots Error: Could not read table file 'etotal.dat'. In case you intended to provide inline data: maybe TeX screwed upon your end-of-lines? ...

I'm not exactly sure what is wrong. There doesn't seem to be anything amiss with my code.
I am aware that there is another question here with a similar title; but that problem was a simple typo. This is not the same problem.

  • is it tab separated – percusse Nov 18 '14 at 17:07
  • Yes, the file is tab separated. – SteelAngel Nov 19 '14 at 13:20
5

The error message is generated if pgfplots cannot open the input file.

That, in turn, indicates search path problems of some sort: apparently, it did not find the file.

Please ensure that it is on the search path. Is it in the same directory of your .tex file? If not, is it on the path for TEXINPUTS?

|improve this answer|||||
  • Just to double check, I put them both on the desktop, and the error persists; I also triple checked the spelling of the filename in the code and on the file as well. – SteelAngel Nov 19 '14 at 13:24
  • What happens if you modify the file extension? Perhaps the TeX distribution on Macs appends .tex or some other stupidity... ? – Christian Feuersänger Nov 19 '14 at 18:02
  • Finally had a chance to get back to this. Apparently yes; the Mac I was working on had set some file extensions to "hidden" and it did append the .txt extension to the file automatically. Interestingly, all .tex files did not have hidden extensions, leading me to not even consider this option initially. The only way to modify the extension was to manually go in and change it in the info box, as changing it by double-clicking the file name would always re-add the extension secretly. Thank you! I wouldn't have guessed this was the problem. – SteelAngel Nov 21 '14 at 17:11
2

I recently encountered this problem with MikTex on Windows 10 and pgfplots 1.14:

It did not open data files without a file extension, so i had to rename my files from "data123" to "data123.txt" and change the path accordingly to make it work. This is probably a pgfplots bug?

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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