1

This question already has an answer here:

The content

\documentclass[margin=1cm]{standalone}

\usepackage{filecontents}
\usepackage{pgfplots}

\begin{filecontents}{dummy.txt}
    category,amountTotal
    excellent,0
    good,8
    neutral,2
    not good,0
    poor,0
\end{filecontents}

\begin{document}
    \begin{tikzpicture}
        \begin{axis}
        [
            ybar,
            symbolic x coords={excellent,good,neutral,not good,poor},
            xtick=data,
            x tick label style={rotate=45,anchor=east},         
            %xticklabels from table={dummy.txt}{category}
        ]
            %\addplot coordinates {(excellent,0) (good,8) (neutral,2) (not good,0) (poor,0)};
            \addplot table[x=category,y=amountTotal,col sep=comma] {dummy.txt};
        \end{axis}
    \end{tikzpicture}
\end{document}

compiles just fine with lualatex -shell-escape filename.tex. However, when I try to get the xticklabels from the file dummy.txt by means of the command xticklabels from table={dummy.txt}{category}

\documentclass[margin=1cm]{standalone}

\usepackage{filecontents}
\usepackage{pgfplots}

\begin{filecontents}{dummy.txt}
    category,amountTotal
    excellent,0
    good,8
    neutral,2
    not good,0
    poor,0
\end{filecontents}

\begin{document}
    \begin{tikzpicture}
        \begin{axis}
        [
            ybar,
            %symbolic x coords={excellent,good,neutral,not good,poor},
            xtick=data,
            x tick label style={rotate=45,anchor=east},         
            xticklabels from table={dummy.txt}{category}
        ]
            %\addplot coordinates {(excellent,0) (good,8) (neutral,2) (not good,0) (poor,0)};
            \addplot table[x=category,y=amountTotal,col sep=comma] {dummy.txt};
        \end{axis}
    \end{tikzpicture}
\end{document}

I get the error

! Package pgfplots Error: Table 'dummy.txt' appears to have too many columns in
 line 8: Ignoring 'good,0'. PGFPlots found that the number of columns is larger
 than the previously determined number of columns. Please verify that every cel
l entry is separated correctly (use braces {<cell entry>} if necessary. Also ve
rify that column names are plain ASCII.). This error is not critical.

What am I doing wrong? Does xticklabels from table understand that the column separator is in this case a comma?

marked as duplicate by Stefan Pinnow, Martin Schröder, Community Mar 9 '17 at 23:56

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.

Browse other questions tagged or ask your own question.