I am trying to plot data from data files which are using the comma as decimal separator instead of a point (as is normal in SI style (French version): http://en.wikipedia.org/wiki/Decimal_mark#Examples_of_use ). However, even after excessive search I cannot find an option that would actually tell pgfplots to read the table with the comma as decimal separator. Minimal (not) working sample:
\documentclass[paper=a4,12pt,version=last,landscape]{scrartcl}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.9\textwidth,
height=0.5\textheight,
xlabel={Standardweg~[mm]},
ylabel={Standardkraft~[N]},
grid=major,
]
\addplot table[x=Standardweg, y=Standardkraft] {Messwerte.TRA};
\end{axis}
\end{tikzpicture}
\end{document}
Messwerte.TRA:
Standardweg Standardkraft
0,000000000000e+000 1,960904836655e+000
-2,349615044750e-004 3,081407308578e+000
-2,349615044750e-004 4,164415359497e+000
-2,349615044750e-004 5,441759109497e+000
-2,349615044750e-004 6,443712234497e+000
-2,349615044750e-004 7,598009109497e+000
-2,349615044750e-004 8,951524734497e+000
-6,029571522959e-001 1,002574348450e+001
-2,349615044750e-004 1,122496223450e+001
-2,349615044750e-004 1,252183723450e+001
On compilation, I get the error:
! Package PGF Math Error: Could not parse input '-2,349615044750e-004' as a floating point number, sorry. The unreadable part was near ',349615044750e-004'.. for every single number in the .TRA-file.
I know that I could find and replace every , with a . in the files, but that is not an option considering the amount of files I have to evaluate.
Also, I tried stuff like /pgf/number format/use comma
, set decimal separator={{,}}
, \pgfkeys{/pgf/number format/.cd,fixed,precision=2,use period}
and use comma
, but none of that helped and I am pretty much running out of options. The documentation for pgfplots did not give any other ideas, either.
So: How do I convince pgfplots to actually read the comma as decimal separator and to not search for the point?
Best Answer
With an uptodate pgf/TikZ version (current on CTAN is 3.0.1a) it is now possible to use the new key
/pgf/number format/read comma as period
:Code: