我创建了一个由 4 个子图形组成的图形:
\begin{figure*}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\textwidth]{1.png}
\caption{1}
\label{fig:1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\textwidth]{2.png}
\caption{2}
\label{fig: 2}
\end{subfigure}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\textwidth]{3.png}
\caption{3}
\label{fig:3}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\textwidth]{4.png}
\caption{4}
\label{fig: 4}
\end{subfigure}
\caption{process}
\label{fig: process}
\end{figure*}
我想在这个图的右边添加一个图例,该怎么做?
非常感谢。
答案1
你可以尝试一下
\documentclass{article}
\usepackage[rightcaption]{sidecap}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{SCfigure}
\begin{subfigure}[b]{0.5\linewidth}
\includegraphics[width=0.4\textwidth]{1.png}
\caption{1}
\label{fig:1}
\end{subfigure}
\end{SCfigure}
.....
\begin{SCfigure}
\begin{subfigure}[b]{0.5\linewidth}
\includegraphics[width=0.4\textwidth]{4.png}
\caption{4}
\label{fig:4}
\end{subfigure}
\end{SCfigure}
\end{document}
或者你可以实施这个类似问答中的建议https://tex.stackexchange.com/questions/29143/caption-on-the-side-of-a-figure
答案2
您的问题不够清楚。缺少有关文档布局、侧边图例的放置方式和位置等信息。
我猜你有两列文档,并且你喜欢将子图像放在两行中。如果我没猜错的话,那么预期结果应该是这样的:
(红线表示文本边框)
\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage[skip=0.5ex]{subcaption}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document
\begin{document}
\begin{figure*}
\setkeys{Gin}{width=\linewidth}
\begin{minipage}{0.74\textwidth}
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics{example-image-duck}
\caption{subcaption 1}
\label{fig:1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics{example-image-duck}
\caption{subcaption 2}
\label{fig: 2}
\end{subfigure}
\medskip
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics{example-image-duck}
\caption{subcaption 3}
\label{fig:3}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\linewidth}
\includegraphics{example-image-duck}
\caption{subcaption 4}
\label{fig: 4}
\end{subfigure}
\end{minipage}
\hfill
\begin{minipage}{0.24\textwidth}
\textbf{Legend:}
descriptions of sub images contents, probably with text in many lines
\end{minipage}
\caption{Process}
\label{fig: process}
\end{figure*}
\lipsum[1-11]
\end{document}