如何在 PgfPlotsTable 中允許非唯一的列名?

如何在 PgfPlotsTable 中允許非唯一的列名?

我已經在 PgfPlotsTable 上苦苦掙扎了一段時間。問題是我無法去掉列名末尾附加的“-indexNum”。有誰知道是否可以選擇使用非唯一的列名稱?我已經閱讀了 PgfPlots 手冊,但找不到任何內容。我也嘗試過重命名列,但也沒有成功。順便說一句,我正在從 CSV 檔案中讀取所有這些值。

我的表的程式碼如下所示:

\begin{table}[ht!]
\begin{center}
    \resizebox{\textwidth}{!}{
        \pgfplotstabletypeset[
            col sep=comma,
            string type,
            assign column name/.style={/pgfplots/table/column name={\textbf{#1}}},
            every column/.code={
                \ifnum\pgfplotstablecol>0
                    \pgfkeysalso{column type/.add={|}{}}
                \fi
            },
            assign column name/.style={/pgfplots/table/column name={#1}},
            every head row/.style={after row=\hline, before row=\hline \multicolumn{1}{c|}{} & \multicolumn{2}{c|}{\textbf{MLR}} & \multicolumn{2}{c|}{\textbf{Ridge}} & \multicolumn{2}{c|}{\textbf{Lasso}} & \multicolumn{2}{c}{\textbf{Elastic Net}} \\ \hline},
            every last row/.style={after row=\hline}
            ]{resources/athletes_cv.csv}
    }
\end{center}
\end{table}

獎勵:有人知道如何合併兩個單元格嗎?那麼運動員佔據了所有空間?這由嵌入圖片中的箭頭表示。

輸出如下圖所示:

PgfPlotsTable 中的表格

謝謝!

相關內容