0

help me please:

I don't understand why pgf show me this error, for all my dates:

Package PGF Math Error: Could not parse input '14.099117,3.068e+6,' as a floating point number, sorry. The unreadable part was near ',3.068e+6,'.. \addplot[color=black] file{dicloro.txt};

this is my archive:

\documentclass[]{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{pgfplots, pgfplotstable, pgf}
\usepackage{xcolor}
\usepgfplotslibrary{fillbetween}
\usepgfplotslibrary{colorbrewer}
\usepgfplotslibrary{patchplots}
\selectcolormodel{cmyk}
\usepackage{mathtools,amsmath,amsthm}
\usetikzlibrary{spy}
\usetikzlibrary{plotmarks}
\pgfplotsset{compat=1.9}
\pgfplotsset{/pgf/number format/use comma,compat=newest}

%opening
\title{PGF plots}
\author{Juliana Pérez}

\begin{document}
    
\maketitle  
    

\begin{tikzpicture}
    \begin{axis}[xlabel=p1, ylabel=p1t, tick style={draw=none}]
        
    \addplot[color=black] file{dicloro.txt};
        
    \end{axis}
\end{tikzpicture}   

\end{document}

1 Answer 1

1

I think pgfplots assumes that columns in data files are separated by a space by default, and you seem to have comma separated columns. Try using

\addplot[color=black] table[col sep=comma]{dicloro.txt};

instead of \addplot[color=black] file{dicloro.txt};.

This will by default use the first column for the x-values, and the second column for the y-values.

6
  • does not work, the same error appears Feb 9, 2021 at 22:10
  • @julianaperezordoñez Can you show a few lines of what your data file looks like? Edit your question to include it. Feb 9, 2021 at 22:12
  • look at this: prnt.sc/yw5e43 Feb 9, 2021 at 22:15
  • 1
    @julianaperezordoñez That is a different error. In the screenshot the error is that pgfplots cannot find the datafile, dicloro.txt. The error you mention in the question is that pgfplots tries to interpret 14.099117,3.068e+6, as a single number. Is dicloro.txt in the same folder as your .txt file? Feb 9, 2021 at 22:21
  • 1
    @Juliperezor, instead of/additionally to writing "thank you" in the comment, please consider upvoting (by clicking on the arrows next to the score) and/or marking it as the accepted answer (by clicking on the checkmark ✓). Jul 11, 2021 at 6:12

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.