使用 subimport 使子圖彼此相鄰

使用 subimport 使子圖彼此相鄰

我想顯示兩個相鄰的子圖(一左一右)。我的問題是它們總是顯示在彼此之上。另外我想使用 subimport 功能而不是 includefigure。不幸的是,我在網路上找到的所有範例都僅使用 includefigure。

我也嘗試了scalebox,但這不起作用:這些圖仍然沒有放置在彼此旁邊,它也縮放了我不想要的軸標籤。影像應該足夠薄以能夠並排放置。

我怎樣才能使這個工作與子導入?

我嘗試過以下程式碼:

\documentclass{article}

\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{import}
\usepackage{pgfplots}

\begin{document}

\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.5\textwidth}
\subimport*{plots/somePath/}{plot1.tex}
\caption{sub caption 1}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\subimport*{plots/somePath/}{plot2.tex}
\caption{sub caption 2}
\end{subfigure}
\caption{test.}
\end{figure}

\end{document}

這是該圖的 tikz 程式碼,可用於兩個子圖進行測試:

\begin{tikzpicture}
\begin{axis}[%
width=1.5in,
height=1in,
at={(0in,0in)},
scale only axis,
xmin=0,
xmax=5,
ymin=0,
ymax=10,
axis background/.style={fill=white}
]
\addplot [color=blue,solid,forget plot]
  table[row sep=crcr]{%
0   0\\
0.555555555555556   1.11111111111111\\
1.11111111111111    2.22222222222222\\
1.66666666666667    3.33333333333333\\
2.22222222222222    4.44444444444444\\
2.77777777777778    5.55555555555556\\
3.33333333333333    6.66666666666667\\
3.88888888888889    7.77777777777778\\
4.44444444444444    8.88888888888889\\
5   10\\
};
\end{axis}
\end{tikzpicture}

相關內容