![如何为整个图形而不是子图添加 x&y 轴标签?](https://linux22.com/image/378238/%E5%A6%82%E4%BD%95%E4%B8%BA%E6%95%B4%E4%B8%AA%E5%9B%BE%E5%BD%A2%E8%80%8C%E4%B8%8D%E6%98%AF%E5%AD%90%E5%9B%BE%E6%B7%BB%E5%8A%A0%20x%EF%BC%86y%20%E8%BD%B4%E6%A0%87%E7%AD%BE%EF%BC%9F.png)
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=1.85in]{1.pdf}\vfill
\label{}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=1.85in]{2.pdf}\vfill
\label{}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=1.85in]{3.pdf}\vfill
\label{}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=1.85in]{4.pdf}\vfill
\label{}
\end{subfigure}
\caption{}
\end{figure}
我有一个带有 4 个子图的图。现在我想将 xlable=Time、ylable=intensity 添加到整个图而不是子图。
答案1
只是阐述一下 John Kormylos 的评论。以下是一些选项。
\documentclass{article}
\usepackage{subcaption}
\usepackage{pdflscape}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\section*{With subcaption}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\matrix (fig) [matrix of nodes]{
\includegraphics[width=1.85in]{example-image.pdf}
&
\includegraphics[width=1.85in]{example-image-a.pdf}
\\
|[text width=1.85in]| {\subcaption{}}
&
|[text width=1.85in]| {\subcaption{}}
\\
\includegraphics[width=1.85in]{example-image-b.pdf}
&
\includegraphics[width=1.85in]{example-image-c.pdf}
\\
|[text width=1.85in]| {\subcaption{}}
&
|[text width=1.85in]| {\subcaption{}}
\\
};
\path (fig-3-1.west) -- (fig-1-1.west) node[midway,above,sloped]{intensity};
\path (fig-4-1.south) -- (fig-4-2.south) node[midway,below]{time};
\end{tikzpicture}
\caption{}
\end{figure}
\clearpage
\section*{Without subcaption}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\matrix (fig) [matrix of nodes]{
\includegraphics[width=1.85in]{example-image.pdf}
&
\includegraphics[width=1.85in]{example-image-a.pdf}
\\
\includegraphics[width=1.85in]{example-image-b.pdf}
&
\includegraphics[width=1.85in]{example-image-c.pdf}
\\
};
\path (fig-2-1.west) -- (fig-1-1.west) node[midway,above,sloped]{intensity};
\path (fig-2-1.south) -- (fig-2-2.south) node[midway,below]{time};
\end{tikzpicture}
\caption{}
\end{figure}
\clearpage
\begin{landscape}
\section*{Landscape with caption}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\matrix (fig) [matrix of nodes]{
\includegraphics[width=1.85in]{example-image.pdf}
&
\includegraphics[width=1.85in]{example-image-a.pdf}
&
\includegraphics[width=1.85in]{example-image-b.pdf}
&
\includegraphics[width=1.85in]{example-image-c.pdf}
\\
|[text width=1.85in]| {\subcaption{}}
&
|[text width=1.85in]| {\subcaption{}}
&
|[text width=1.85in]| {\subcaption{}}
&
|[text width=1.85in]| {\subcaption{}}
\\
};
\path (fig-1-1.south west) -- (fig-1-1.north west) node[midway,above,sloped]{intensity};
\path (fig-1-1.north) -- (fig-1-4.north) node[midway,above]{time};
\end{tikzpicture}
\caption{}
\end{figure}
\end{landscape}
\clearpage
\begin{landscape}
\section*{Landscape without caption}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\matrix (fig) [matrix of nodes]{
\includegraphics[width=1.85in]{example-image.pdf}
&
\includegraphics[width=1.85in]{example-image-a.pdf}
&
\includegraphics[width=1.85in]{example-image-b.pdf}
&
\includegraphics[width=1.85in]{example-image-c.pdf}
\\
};
\path (fig-1-1.south west) -- (fig-1-1.north west) node[midway,above,sloped]{intensity};
\path (fig-1-1.south) -- (fig-1-4.south) node[midway,below]{time};
\end{tikzpicture}
\caption{}
\end{figure}
\end{landscape}
\end{document}
这给你例如
如果你想要轴,只需将\path
图片中的命令替换为
\draw[-latex] ([xshift=-2mm]fig-1-1.south west) -- ([xshift=-2mm]fig-1-1.north west) node[midway,above,sloped]{intensity};
\draw[-latex] ([yshift=2mm]fig-1-1.north) -- ([yshift=2mm]fig-1-4.north) node[midway,above]{time};
要得到
其他选项也类似。
编辑:图中带有标题。
\documentclass{article}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\section*{With subcaptions in the pics}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\matrix (fig) [matrix of nodes]{
\includegraphics[width=1.85in]{example-image.pdf}
&
\includegraphics[width=1.85in]{example-image-a.pdf}
\\[-1cm] %<- adjust this to move the height of the subcaptions up or down
|[text width=1.85in]| {\subcaption{}}
&
|[text width=1.85in]| {\subcaption{}}
\\[0.2cm] %<- adjust this to make the distance to the next row smaller or larger
\includegraphics[width=1.85in]{example-image-b.pdf}
&
\includegraphics[width=1.85in]{example-image-c.pdf}
\\[-1cm] %<- adjust this to move the height of the subcaptions up or down
|[text width=1.85in]| {\subcaption{}}
&
|[text width=1.85in]| {\subcaption{}}
\\
};
\draw[-latex] ([xshift=-2mm,yshift=2mm]fig-1-1.south west) -- ([xshift=-2mm,yshift=-2mm]fig-1-1.north west) node[midway,above,sloped]{intensity};
\draw[-latex] ([xshift=-2mm,yshift=2mm]fig-3-1.south west) -- ([xshift=-2mm,yshift=-2mm]fig-3-1.north west) node[midway,above,sloped]{intensity};
\draw[-latex] ([yshift=-3mm,xshift=2mm]fig-4-1.south west) -- ([yshift=-3mm,xshift=-2mm]fig-4-1.south east) node[midway,below]{time};
\draw[-latex] ([yshift=-3mm,xshift=2mm]fig-4-2.south west) -- ([yshift=-3mm,xshift=-2mm]fig-4-2.south east) node[midway,below]{time};
\end{tikzpicture}
\caption{}
\end{figure}
\end{document}