子图未底部对齐

子图未底部对齐

我正在尝试将两个pgfplots图形(均已width=95\textwidth设置)底部对齐,并绘制一个边界框。设置这两个subfigure图形的相关代码:

\begin{figure}
    \centering
     \begin{subfigure}[b]{0.5\linewidth}
        \centering
        \input{./texfig/FN_plot}
    \end{subfigure}%
    \hfill
    \begin{subfigure}[b]{0.5\linewidth}
        \centering
        \input{./texfig/FN_plot_hot}
    \end{subfigure}
    \caption{FN plot. Protrusion height $h=\SI{20}{nm}$. Real (apex) $\beta = 11.8$. On the left, $T_{\text{ambient}} = \SI{300}{K}$ and on the right $T_{\text{ambient}} = \SI{800}{K}$.}
    \label{fig:FN_plot}
\end{figure}

结果是:

为什么它们没有底部对齐?显然,边界框没有重叠。通过减小图形的宽度,我可以让它们对齐,但它们之间的空白太多了。有什么想法吗?

编辑:删除所有不相关的内容,以下是.tex文件:

FN_plot.tex

\begin{tikzpicture}
    \begin{groupplot}[group style={group size=1 by 2, vertical sep=1.3cm}]

    \nextgroupplot[
        width=0.8\linewidth,
        xmin = 0.00125, xmax = 0.00135,
        ymin =-24.15, ymax = -23.85,
        ]   

    \nextgroupplot[
        width=0.95\textwidth,
        xmin = 0, xmax = 0.05,
        ymin =-200, ymax = -20,
        ytick = {-20,-60,...,-220},
        xtick = {0,0.01,...,0.04},
        xlabel={$1/E$ $\left[(\si{MV/m})^{-1}\right]$},
        ylabel={$\ln{(I/E^2)}$ $\left[\si{A.m^2.MV^{-2}}\right]$},
        legend pos = north east,
        legend cell align = left,
        legend style = {draw=none,fill=none}]

    \end{groupplot}


    \draw (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}

FN_plot_hot.tex

\begin{tikzpicture}[declare function={Inf=inf;}]
    \begin{axis}[
        width=0.95\textwidth,
        xmin = 0, xmax = 0.05,
        ymin =-200, ymax = -20,
        ytick = {-20,-60,...,-220},
        xtick = {0,0.01,...,0.04},
        xlabel={$1/E$ $\left[(\si{MV/m})^{-1}\right]$},
        %ylabel={$\ln{(I/E^2)}$ $\left[\si{A.m^2.MV^{-2}}\right]$},
        yticklabels={,,},
        legend pos = north east,
        legend cell align = left,
        legend style = {draw=none,fill=none}]

    \end{axis}

    \draw (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}

结果是

答案1

您可以使用groupplot来一​​次性绘制所有三个图。只需使用

\nextgroupplot[hide axis]%2

对于第二个图,这样它就不会被绘制。这是一个示例。

\documentclass{article}
\usepackage{pgfplots,subcaption,siunitx}
\pgfplotsset{compat=1.12}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{figure}
    \centering
     \begin{tikzpicture}[shorten >=4pt,shorten <=4pt]
\begin{groupplot}[group style={group size=2 by 2},
height=3.5cm,width=3.5cm,/tikz/font=\small]
\nextgroupplot%1
\addplot coordinates {(0,1) (1,0)};
\nextgroupplot[hide axis]%2
%\addplot coordinates {(0,1) (1,0)};
\nextgroupplot%3
\addplot coordinates {(0,1) (1,0)};
\nextgroupplot%4
\addplot coordinates {(0,1) (1,0)};
\end{groupplot}
\end{tikzpicture}
    \caption{FN plot. Protrusion height $h=\SI{20}{nm}$. Real (apex) $\beta = 11.8$. On the left, $T_{\text{ambient}} = \SI{300}{K}$ and on the right $T_{\text{ambient}} = \SI{800}{K}$.}
    \label{fig:FN_plot}
\end{figure}
\end{document}

在此处输入图片描述

通过你的方法它就变成了(这也适用于\input

\documentclass{article}
\usepackage{pgfplots,subcaption,siunitx}
\pgfplotsset{compat=1.12}
\usepgfplotslibrary{groupplots}
\begin{document}
\begin{figure}
    \centering
     \centering
     \begin{subfigure}[b]{0.5\linewidth}
        \centering
    \begin{tikzpicture}[shorten >=4pt,shorten <=4pt]
\begin{groupplot}[group style={group size=1 by 2},
height=3.5cm,width=3.5cm,/tikz/font=\small]
\nextgroupplot%1
\addplot coordinates {(0,1) (1,0)};
\nextgroupplot%2
\addplot coordinates {(0,1) (1,0)};
\end{groupplot}
\end{tikzpicture}
\end{subfigure}%
    \hfill
\begin{subfigure}[b]{0.5\linewidth}
        \centering
        \begin{tikzpicture}[shorten >=4pt,shorten <=4pt]
\begin{axis}[height=3.5cm,width=3.5cm,/tikz/font=\small]
\addplot coordinates {(0,1) (1,0)};
\end{axis}
\end{tikzpicture}
\end{subfigure}%
    \caption{FN plot. Protrusion height $h=\SI{20}{nm}$. Real (apex) $\beta = 11.8$. On the left, $T_{\text{ambient}} = \SI{300}{K}$ and on the right $T_{\text{ambient}} = \SI{800}{K}$.}
    \label{fig:FN_plot}
\end{figure}
\end{document}

在此处输入图片描述

通过你的文件,我得到了这个

在此处输入图片描述

相关内容