0

I have the following document

\documentclass{standalone}
\usepackage{pgfplotstable}
\usepackage{booktabs}


\begin{document}
\pgfplotstableread{
    1 55.00
    2 5.00
    13 5.00
    14 5.00
    15 5.00
    16 15.00
    }{\tabledata}
    \pgfplotstabletranspose[string type, colnames from={0}]{\tabledataT}{\tabledata}
    \pgfplotstabletypeset[
    precision=3,
    columns/0/.style={string type},
    every head row/.style={
    before row={\toprule}},
    every last row/.style={after row=\bottomrule}]{\tabledataT}
\end{document}

The resulting table looks like this: enter image description here I am looking for a way to replace the elements of the first column with the following row descriptions

Degree\\
\shortstack{Test set\\ misclassifications (\%)}.

Any ideas?

1 Answer 1

1

After much messing about, I give up on attempting better elegancy than this:

\documentclass{standalone}
\usepackage{pgfplotstable}
\usepackage{booktabs}

\pgfplotsset{compat=1.17}


\begin{document}

\pgfplotstableread{
    1 55.00
    2 5.00
    13 5.00
    14 5.00
    15 5.00
    16 15.00
    }{\tabledata}

    \pgfplotstabletranspose[string type]{\tabledataT}{\tabledata}

    \pgfplotstablecreatecol[
        create col/set list={{Degree},{\shortstack{Test set\\ misclassifications (\%)}}}
    ]{description}{\tabledataT}

    \pgfplotstabletypeset[
        columns={description,0,1,...,5},
        columns/description/.style={string type},
        precision=3,
        every head row/.style={
            output empty row,
        before row={\toprule}},
        every last row/.style={after row=\bottomrule},
        header=false]{\tabledataT}
\end{document}

Table width headers as requested

1
  • 1
    Looks good to me! I've seen worse with pgfplotstable.
    – MDescamps
    May 26, 2021 at 13:14

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.