0

This question already has an answer here:

I have some troubles using external files for the data visualization library of TikZ. This is my MWE:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\begin{document}

\begin{tikzpicture}
\datavisualization [scientific axes, visualize as line]
data [read from file=foo.csv] ;

\end{tikzpicture}
\end{document}

Where foo.csv is basically just

x,y
0,0
1,1
2,2

The same problem has been described in this topic a year ago. Compilation produces the error

! Package PGF Math Error: Sorry, an internal routine of the floating point     unit got an ill-formatted floating point number `'. The unreadable part was near ''..

See the PGF Math package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.7 ... scatter ] data [ read from file=foo.dat ];

One solution is to replace all commas with spaces in foo.csv and to add separator=\space to the data options. However, this ONLY works if column headlines are specifically named x and y, despite the pgf manual stating otherwise.

To sum it up: importing data in \datavisualization only works for space separated values and only if the columns are named x and y for me. Is this a bug? Am I missing something?

marked as duplicate by Zarko, Jesse, Community Apr 10 '16 at 3:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Did you consider the provided answer in the linked question? – JMP Apr 9 '16 at 7:15
  • I did, but whether I define the headline inside the external file or via options makes no difference. And the neglection of commas as a separator, which wasn't solved in this answer either, is really irritating. – Niclas Apr 9 '16 at 9:12
  • Actually it works for me. You have to remove the header in the data file. I guess that there is some bug in how the lines of the file header are interpreted. – JMP Apr 9 '16 at 9:15
  • You are right, that works! Don't know, what I had tried in the first place. Still, this is weird behavior and apparently unchanged for years. I try and report this at the sourceforge project. – Niclas Apr 9 '16 at 17:38