2

How can I plot data from CSV file when comma is separator of decimal part?

Part of my CSV file:

U f(U)
0 6,12323399573677E-016
0,1257 1,2536924115
0,2514 2,4876019375

I've tried this trick but it doesn't help me.

\pgfkeys{/pgf/number format/.cd,fixed,precision=2,use comma}

Is any elegant solution of my problem (without replacing characters in data file)?

Here is how I generate the plot:

\begin{tikzpicture}
\begin{axis}[ xlabel={$x$}, ylabel={$y$}, ]
\addplot[blue] table {wykres-2.1-przyklad 3.csv};
\end{axis}
\end{tikzpicture}
9
  • That looks like you have white space as the delimiter, so it is not a comma-separated values file... Can you give an example of what your final purpose is? BTW, Welcome to TeX.SX!
    – darthbith
    Jan 17 '15 at 14:39
  • 2
    Try with ,use comma,col sep=space.
    – user11232
    Jan 17 '15 at 14:45
  • @darthbith I've mean that comma is separator between decimal and rest in float number. Normally in computers dot is use as separator for example "1.2222" but in my country we use comma, so it should look like "1,2222". I've data from spreadsheet and I must use it in my Latex document to plot.
    – bigben
    Jan 17 '15 at 14:46
  • @HarishKumar Package pgfkeys Error: I do not know the key '/pgf/number format/col sep'
    – bigben
    Jan 17 '15 at 14:49
  • @bigben I got what you mean, what I meant was what Harish Kumar pointed out - your column separators are spaces, not commas, so it is not a CSV file. Can you nonetheless provide an example of how you're plotting the data so we can try fixes? Also, see here: tex.stackexchange.com/q/159638/32374
    – darthbith
    Jan 17 '15 at 14:49

Browse other questions tagged or ask your own question.