# Table header not shown with pgfplotstable in Tikzpicture environment

I'm trying to get pgfplotstable to show the header of the columns in my csv file as well. It seems like this should be the default behaviour, and I can't seem to find anyone else having this problem. Here is the MWE:

\documentclass{article}
\usepackage{pgfplotstable}

% The input .csv file.
\begin{filecontents*}{TestPGFPlotsTable.csv}
A,B,C,D
1,5,9,13
2,6,10,14
3,7,11,15
4,8,12,16
\end{filecontents*}

% To add a line above and below the header and table.
% Using hline instead of booktabs to make MWE
\pgfplotstableset{
every last row/.style={after row=\hline}
}

\begin{document}

\begin{tikzpicture}
\pgfplotstableset{
col sep=comma,
}
\pgfplotstabletypeset[]{TestPGFPlotsTable.csv}

\end{tikzpicture}

\end{document}


And here is what the result looks like:

And the result I want to get.

• Short answer is don't use pgfplotstabletypeset in the tikzpicture environment – FortuneCookie Dec 15 '19 at 20:29

Is there a reason why the \pgfplotstabletypeset is within a tikzpicture environment?

\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{caption}

% The input .csv file.
\begin{filecontents*}{TestPGFPlotsTable.csv}
A,B,C,D
1,5,9,13
2,6,10,14
3,7,11,15
4,8,12,16
\end{filecontents*}

% To add a line above and below the header and table.
% Using hline instead of booktabs to make MWE
\pgfplotstableset{
every last row/.style={after row=\hline},
}

\begin{document}

\pgfplotstableset{
col sep=comma
}
\pgfplotstabletypeset{TestPGFPlotsTable.csv}

\begin{center}
\pgfplotstabletypeset{TestPGFPlotsTable.csv}
\end{center}

\begin{table}[htb]
\centering
\caption{My caption}
\pgfplotstabletypeset{TestPGFPlotsTable.csv}
\end{table}
\end{document}


• Thanks! That was very silly. – FortuneCookie Dec 15 '19 at 20:27
• @FortuneCookie You're welcome! Not silly at all :):):) – CarLaTeX Dec 15 '19 at 20:31