# The option header=false does not work to consider first row containing symbolic name in data text file with pgfplots

I want to do something simple. I have the following data in a text file called example.txt:

a 1.254 b 0.995 c 2.782
d 5.722

I want to plot all the data with a, b, c and on X axis but pgfplots think first line is a header so I want to use header=false to consider the first row (what I put in comment) but I get the error "tikz does not know header".

Here my code:

\documentclass[11pt]{standalone}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
ylabel={Y},
xlabel={X},
symbolic x coords={a,b,c,d},
xtick={a,b,c,d},
xticklabels={AAAA,BBBB, CCCC,DDDD}
]
\end{axis}
\end{tikzpicture}

\end{document}


• \addplot +[only marks,color=red] table[header=false,] {example.txt};, i.e. pass header=false to the table, not to the plot. – marmot Jan 31 at 20:49
• I knew it was something simple.... thank you for the fast answer! – Willi Jan 31 at 20:51
• @CarLaTeX Done. I'll be happy to remove it if other users feel it should not be there. – marmot Feb 1 at 4:44
• Good find! Do you want to close your question as a duplicate of tex.stackexchange.com/questions/29063/… ? I believe that your question is still very useful since, as long as one does not know the root of the problem, it is hard to know which key words one should look for, and once you know, you do no longer ask. – marmot Feb 1 at 16:16

I will be happy to remove this if you feel like you want to delete your question, and I am writing this because @CarLaTeX asked me to.

You need to put header=false to the options of the table, not the plot.

## Side remark

You make things slightly easier for others if you use filecontents to add the data. That way you may attract more users to play with the code.

\documentclass[11pt]{standalone}
\usepackage{pgfplots}

\usepackage{filecontents}
\begin{filecontents*}{example.txt}
a 1.254
b 0.995
c 2.782
d 5.722
\end{filecontents*}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ylabel={Y},
xlabel={X},
symbolic x coords={a,b,c,d},
xtick={a,b,c,d},
xticklabels={AAAA,BBBB, CCCC,DDDD}
]