如何用带有文字的箭头连接 3 幅并排的图片

如何用带有文字的箭头连接 3 幅并排的图片

我想要完成这样的事情:

在此处输入图片描述

我唯一能做的就是将 3 张图片分开,不用箭头。请参阅下面的示例代码。非常感谢您的帮助。

\begin{figure}
\centering
\mbox{\subfigure{\includegraphics[width=0.8in]{ss.png}}\quad
\hspace{1.0in}%
\subfigure{\includegraphics[width=0.8in]{ser.png}
\hspace{1.0in}%
\subfigure{\includegraphics[width=0.8in]{ss.png} }}}
\caption{Text pertaining to both graphs ...} \label{fig12}
\end{figure}

答案1

使用节点的相对定位和quotes箭头上的文本库:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, 
                positioning,
                quotes}
\usepackage{graphicx}

\begin{document}
    \begin{figure}
    \centering
    \setkeys{Gin}{height=20mm, width=\linewidth}
\begin{tikzpicture}[
node distance = 2mm and 44mm,
image/.style = {text width=10mm, inner ysep=0pt},   % style for images
  num/.style = {font=\small, text=blue},            % blue numbers
every edge quotes/.style= {auto, font=\small},
  arr/.style = {-Triangle, semithick}
                   ]
\node[image, label=Caller (R)]  (A) {\includegraphics{example-image-a}};
\node[image, label=Server (S),
      right=of A]               (B) {\includegraphics{example-image-b}};
\node[image, label=Calee (E),
      right=of B]               (C) {\includegraphics{example-image-c}};
%
    \begin{scope}[node distance = 2mm and 0mm,
                  nodes=num]  
\node[below right=of A.north east]  (1) {$(1)$};
\node[above right=of A.south east]  (3) {$(3)$};
\node[right=of B.east]              (2) {$(2)$};
    \end{scope}
%
\draw[arr] (1) to ["Call Ph. Num(E)"]       (1 -| B.west);
\draw[arr] (3 -| B.west) to ["$E\in$ AuthentiCall Users" ']  (3);
\draw[arr] (2) to ["Incoming call from R"]  (C.west);
%
\draw[blue, dashed, arr]
    ([yshift=-2mm] A.south)
        node[below right, text=black] {\textit{ID(R), PhNum(R), \dots}} --
    ([yshift=-2mm] C.south)
        node[below  left, text=black] {\textit{ID(E), PhNum(E), \dots}};
\end{tikzpicture}
    \caption{Text pertaining to both graphs ...} 
\label{fig12}
    \end{figure}
\end{document}

在此处输入图片描述

答案2

也许是这样的:

在此处输入图片描述

这是使用以下代码完成的:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc}
\usepackage{mwe}
\begin{document}

\begin{figure}
  \centering
  \begin{tikzpicture}[image/.style={minimum width=0.8in}, % style for images
                      num/.style={blue, font=\small},     % blue numbers
                      >=LaTeX
    ]
    \node[image] (A) at (0,0){\includegraphics[width=0.8in]{example-image-a}};
    \node[image] (B) at (2.5in,0){\includegraphics[width=0.8in]{example-image-b}};
    \node[image] (C) at (5in,0){\includegraphics[width=0.8in]{example-image-c}};
    \node[num] (1) at ($ (0.2,0)+(A.north east) $) {$(1)$};
    \node[num] (2) at ($ (0.2,0)+(B.east)       $) {$(2)$};
    \node[num] (3) at ($ (0.2,0)+(A.south east) $) {$(3)$};
    \draw[->](1)--node[above]{Call Ph. Num(E)}(B.north west);
    \draw[<-](3)--node[above]{$E\in$ AuthentiCall Users}(B.south west);
    \draw[->](2)--node[above]{Incoming call from R}(C.west);
  \end{tikzpicture}
  \caption{Text pertaining to both graphs ...} \label{fig12}
\end{figure}

\end{document}

据我所知,subfigure环境不是必需的。如果相同的想法与overlay规范一起适用。

相关内容