我想将表格和图像放在同一高度(子浮动)

我想将表格和图像放在同一高度(子浮动)
\begin{figure}[!h]
    \subfloat{\includegraphics[width=0.5\textwidth]{plot/figlior.png}}
    \renewcommand\intextsep{5}
\subfloat{\renewcommand\arraystretch{0.5}
            \begin{tabular}{l|l|l|c}
                &Low&OR&Upper\\
                \toprule
                0&0.47&0.51&0.55\\
                1&0.59&0.7&0.82\\
                2&0.52&0.61&0.72\\
                3&0.64&0.87&1.17\\
                4&1.01&2.11&4.45\\
                $5^{+}$&0.17&1.32&7.95\\
                \bottomrule
            \end{tabular}

}
\caption{OR e Intervallo di Confidenza al 95\%}
\label{orchildren}
\end{figure}

在此处输入图片描述

答案1

您可以执行以下操作

\documentclass{article}

\usepackage{tikz}

\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{float}

\begin{document}

\begin{figure}[t]
\centering
\resizebox {0.45 \columnwidth}{!}{
\subfigure[Line]{\centering
\includegraphics{bh.jpg}
}
}
\hfil
\resizebox {0.45 \columnwidth}{!}{
\subfigure{\centering
\begin{tikzpicture}
\draw (0 , 0) node {\begin{tabular}{l|l|l|c}
~ & Low & OR & Upper \\
\hline
0 & 0.47 & 0.51 & 0.55 \\
1 & 0.59 & 0.7 & 0.82 \\
2 & 0.52 & 0.61 & 0.72 \\
3 & 0.64 & 0.87 & 1.17 \\
4 & 1.01 & 2.11 & 4.45 \\
$5^{+}$ & 0.17 & 1.32 & 7.95 \\
\hline
\end{tabular}};
\end{tikzpicture}
}
}
\caption{OR e Intervallo di Confidenza al 95\%}
\label{orchildren}
\end{figure}

\end{document}

输出如下

子图

答案2

如果您不需要为图像/表格添加单独的标题,您可以简单地将它们放在minipages一起:

\documentclass{article}

\usepackage{graphicx}
\usepackage{booktabs}

\begin{document}


\begin{figure}[htbp]
    \begin{minipage}{.45\textwidth}
        \includegraphics[width=\textwidth]{example-image}
    \end{minipage}
    \hfill
    \begin{minipage}{.4\textwidth}
        \renewcommand\arraystretch{0.5}
        \begin{tabular}{lllc}
                \toprule
            &Low&OR&Upper\\
            \midrule
            0&0.47&0.51&0.55\\
            1&0.59&0.7&0.82\\
            2&0.52&0.61&0.72\\
            3&0.64&0.87&1.17\\
            4&1.01&2.11&4.45\\
            $5^{+}$&0.17&1.32&7.95\\
            \bottomrule
        \end{tabular}
    \end{minipage}
    \caption{OR e Intervallo di Confidenza al 95\%}
    \label{orchildren}
\end{figure}


\end{document}

在此处输入图片描述

(请注意,不建议在booktabs包装中使用垂直线)

答案3

\documentclass{article}
\usepackage{booktabs}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\begin{document}

\begin{figure}[!htb]
    \subfloat{\includegraphics[width=0.5\textwidth]{plot/figlior.png}}
    \renewcommand\intextsep{5}
    \subfloat{\renewcommand\arraystretch{0.5}
        \raisebox{\dimexpr\height-1ex}{%
          \begin{tabular}{l|l|l|c}
            &Low&OR&Upper\\\toprule
            0&0.47&0.51&0.55\\
            1&0.59&0.7&0.82\\
            2&0.52&0.61&0.72\\
            3&0.64&0.87&1.17\\
            4&1.01&2.11&4.45\\
            $5^{+}$&0.17&1.32&7.95\\\bottomrule
        \end{tabular}%
       }%   
    }
    \caption{OR e Intervallo di Confidenza al 95\%}
    \label{orchildren}
\end{figure}

\end{document}

在此处输入图片描述

相关内容