我有以下文件
\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}
结果表如下所示: 我正在寻找一种方法来用以下行描述替换第一列的元素
Degree\\
\shortstack{Test set\\ misclassifications (\%)}.
有任何想法吗?
答案1
经过多次混乱之后,我放弃尝试比这更好的优雅:
\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}