LaTex技巧(五):如何在图形的右方插入统计表格呢?

时间:2022-04-04 06:42:05

插入统计表格

要求:直方图显示在其单元格的顶部,而描述性统计数据表出现在其单元格的底部。
你可以\adjustbox{valign=T}{...}
例子:

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}   
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{graphicx,adjustbox,array}

\newcommand{\Mtable}{%
\begin{tabular}[t]{p{2cm}|p{1cm}}    
    \hline
    Statistic & Value \\\hline
    Max & 2 \\
    min & 3 \\
    Mean & 2 \\
    Std & 3\\
    Skew & 2 \\
    Kurtosis & 3 \\
    Percent Positive & 100\\ \hline
    \multicolumn{2}{c}{``Descriptive Statistics}\\ 
    \multicolumn{2}{c}{for Simulated Set 3"} \\[-1ex] 
    \multicolumn{2}{c}{}
\end{tabular}
}
\begin{document}

\begin{tabular}{|c|c|}\hline
\adjustbox{valign=T}{\centering
\begin{tabular}{c}
    \includegraphics[width=60mm]{example-image-4x3.pdf}\\
    ``Histogram of Steepener Results\\ for Simulated Set 3"
\end{tabular}}
&
\adjustbox{valign=T}{\Mtable}
\\ \hline
\adjustbox{valign=T}{\centering
\begin{tabular}{c}
    \includegraphics[width=60mm]{example-image-4x3.pdf}\\
    ``Histogram of Steepener Results\\ for Simulated Set 3"
\end{tabular}}
&
\adjustbox{valign=T}{\Mtable}\\ \hline
\end{tabular}

\end{document}

当然你也没有必要用上面的ajust,可以从graphicx中引用\raisebox如下:

\begin{tabular}{|c|c|}\hline
\begin{tabular}[t]{c}
    \raisebox{-\height}{\includegraphics[width=60mm]{example-image-4x3.pdf}}\\
    ``Histogram of Steepener Results\\ for Simulated Set 3"
\end{tabular}
&
\Mtable
\\ \hline
\begin{tabular}[t]{c}
    \raisebox{-\height}{\includegraphics[width=60mm]{example-image-4x3.pdf}}\\
    ``Histogram of Steepener Results\\ for Simulated Set 3"
\end{tabular}
&
\Mtable
\\ \hline
\end{tabular}

效果如下:

LaTex技巧(五):如何在图形的右方插入统计表格呢?