下面有一张表格,我想在表格右侧插入一个图形。表格和图形都将使用一个标题。下面是我为表格编写的代码。
\begin{table*}
\begin{center}
\begin{tabular}{|l|l|cc|cc|cc|}
\hline%\noalign{\smallskip}
\multirow{2}{*}{Type} & \multirow{2}{*}{Model} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$} \\
& & SSIM & PSNR & SSIM & PSNR & SSIM & PSNR \\
\hline
\multirow{3}{*}{Deterministic} \ & 2D ConvLSTM \cite{convlstm} & 0.712 & 23.58 & 0.639 & 22.85 & 0.551 & 20.13 \\
& PredRNN++ \cite{wang-predrnn} & 0.865 & 28.47 & 0.741 & 25.21 & 0.702 & 23.51 \\
& E3D-LSTM \cite{wang-e3d} & \textbf{0.879} & \textbf{29.31} & 0.810 & 27.24 & 0.798 & 26.82 \\
\hline
\multirow{2}{*}{Stochastic} & Variational 2D ConvLSTM \cite{vrnn} & 0.787 & 25.76 & 0.733 & 24.83 & 0.672 & 23.13 \\
& Variational 3D ConvLSTM (Ours) & 0.866 & 28.31 & \textbf{0.852} & \textbf{27.89} & \textbf{0.846} & \textbf{27.66} \\
\hline
\end{tabular}
\end{center}
\caption{Results on the KTH action dataset when using 10 frames to predict 20 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$), 40 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$), and 60 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$) timesteps into the future. The metrics are computed frame-wise. Higher SSIM and PSNR scores indicate better results.}
\label{table:quantitativekth}
\end{table*}
我尝试按照这里的代码包含表格作为子图但图形始终出现在下方。
\begin{table*}
\begin{center}
\subfloat[][]{\begin{tabular}{|l|l|cc|cc|cc|}
\hline%\noalign{\smallskip}
\multirow{2}{*}{Type} & \multirow{2}{*}{Model} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$} \\
& & SSIM & PSNR & SSIM & PSNR & SSIM & PSNR \\
\hline
\multirow{3}{*}{Deterministic} \ & 2D ConvLSTM \cite{convlstm} & 0.712 & 23.58 & 0.639 & 22.85 & 0.551 & 20.13 \\
& PredRNN++ \cite{wang-predrnn} & 0.865 & 28.47 & 0.741 & 25.21 & 0.702 & 23.51 \\
& E3D-LSTM \cite{wang-e3d} & \textbf{0.879} & \textbf{29.31} & 0.810 & 27.24 & 0.798 & 26.82 \\
\hline
\multirow{2}{*}{Stochastic} & Variational 2D ConvLSTM \cite{vrnn} & 0.787 & 25.76 & 0.733 & 24.83 & 0.672 & 23.13 \\
& Variational 3D ConvLSTM (Ours) & 0.866 & 28.31 & \textbf{0.852} & \textbf{27.89} & \textbf{0.846} & \textbf{27.66} \\
\hline
\end{tabular}
}
\quad
\subfloat[][]{\includegraphics[width=0.1\textwidth]{kth.png}}
\end{center}
\caption{Results on the KTH action dataset when using 10 frames to predict 20 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$), 40 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$), and 60 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$) timesteps into the future. The metrics are computed frame-wise. Higher SSIM and PSNR scores indicate better results.}
\label{table:quantitativekth}
\end{table*}
答案1
- 你的表格有点太宽了,所以在下面的 MWE 中我减少了表格中使用的字体大小和
\tabcolsep
- 表格和图像都封装在表格中
- 对于图形的垂直居中,使用包
valign=c
中定义的 c 选项adjustbox
(它还加载graphicx
包,
\documentclass[twocolumn]{article}
%\usepackage{geometry}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage[export]{adjustbox}
\usepackage{multirow}
\usepackage{siunitx}
\begin{document}
\begin{table*}
\centering
\setlength\tabcolsep{4pt}
\begin{tabular}{@{} lr @{}}
\small
\begin{tabular}{@{} |l|l|cc|cc|cc|@{}}
\hline
\multirow{2}{*}{Type} & \multirow{2}{*}{Model} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$} \\
& & SSIM & PSNR & SSIM & PSNR & SSIM & PSNR \\
\hline
\multirow{3}{*}{Deterministic} \ & 2D ConvLSTM \cite{convlstm} & 0.712 & 23.58 & 0.639 & 22.85 & 0.551 & 20.13 \\
& PredRNN++ \cite{wang-predrnn} & 0.865 & 28.47 & 0.741 & 25.21 & 0.702 & 23.51 \\
& E3D-LSTM \cite{wang-e3d} & \textbf{0.879} & \textbf{29.31} & 0.810 & 27.24 & 0.798 & 26.82 \\
\hline
\multirow{2}{*}{Stochastic} & Variational 2D ConvLSTM \cite{vrnn} & 0.787 & 25.76 & 0.733 & 24.83 & 0.672 & 23.13 \\
& Variational 3D ConvLSTM (Ours) & 0.866 & 28.31 & \textbf{0.852} & \textbf{27.89} & \textbf{0.846} & \textbf{27.66} \\
\hline
\end{tabular}
&
\includegraphics[width=0.1\linewidth,valign=c]{example-image-duck}
\end{tabular}
\caption{Results on the KTH action dataset when using 10 frames to predict 20 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$), 40 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$), and 60 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$) time steps into the future. The metrics are computed frame-wise. Higher SSIM and PSNR scores indicate better results.}
\label{table:quantitativekth}
\end{table*}
\end{document}
附录:
如果您希望表格和图像在底部对齐,那么只需添加选项[b]˙to insert4d table and at image remove option
valign=c`:
\documentclass[twocolumn]{article}
\usepackage[export]{adjustbox}
\usepackage{multirow}
\usepackage{siunitx}
\begin{document}
\begin{table*}
\centering
\setlength\tabcolsep{4pt}
\begin{tabular}{@{} lr @{}}
\small
\begin{tabular}[b]{@{} |l|l|cc|cc|cc|@{}}
\hline
\multirow{2}{*}{Type} & \multirow{2}{*}{Model} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$} & \multicolumn{2}{c|}{$\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$} \\
& & SSIM & PSNR & SSIM & PSNR & SSIM & PSNR \\
\hline
\multirow{3}{*}{Deterministic} \ & 2D ConvLSTM \cite{convlstm} & 0.712 & 23.58 & 0.639 & 22.85 & 0.551 & 20.13 \\
& PredRNN++ \cite{wang-predrnn} & 0.865 & 28.47 & 0.741 & 25.21 & 0.702 & 23.51 \\
& E3D-LSTM \cite{wang-e3d} & \textbf{0.879} & \textbf{29.31} & 0.810 & 27.24 & 0.798 & 26.82 \\
\hline
\multirow{2}{*}{Stochastic} & Variational 2D ConvLSTM \cite{vrnn} & 0.787 & 25.76 & 0.733 & 24.83 & 0.672 & 23.13 \\
& Variational 3D ConvLSTM (Ours) & 0.866 & 28.31 & \textbf{0.852} & \textbf{27.89} & \textbf{0.846} & \textbf{27.66} \\
\hline
\end{tabular}
&
\includegraphics[width=0.1\linewidth]{example-image-duck}
\end{tabular}
\caption{Results on the KTH action dataset when using 10 frames to predict 20 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:30}$), 40 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:50}$), and 60 ($\text{x}_{1:10} \rightarrow \hat{\text{x}}_{11:70}$) time steps into the future. The metrics are computed frame-wise. Higher SSIM and PSNR scores indicate better results.}
\label{table:quantitativekth}
\end{table*}
\end{document}