在两张tikz图片之间画箭头

发布于 2025-01-11 18:26:53 字数 4780 浏览 0 评论 0原文

我想从一张 tikzpicture 到另一张 tikzpicture 绘制一个箭头,以包含在我在 Rmarkdown 中制作的 Beamer 演示文稿中。我尝试遵循此问题的答案:用箭头连接两张 tikz 图片。然而,它对我不起作用,因为它将两个图像连接在一起。这是我的初始代码(使其适合幻灯片中的要点):

编辑:我已将我的 YAML 包含在 Rmarkdown 中。

---
title: "This title must be included in the first slide but is very very long"
subtitle: "Masters Thesis presentation"
institute: "My school"
author: First Last
date: March 2022
output: 
  beamer_presentation: 
    theme: "Madrid"
header-includes:
   - \AtBeginDocument{\title[short title for footline]{This title must be included in the first slide but is very very long}}
   - \usepackage{tikz}
   - \usepackage{subfig}
   - \usepackage{natbib}
   - \usetikzlibrary{automata, positioning, arrows, calc}
   - \usepackage{algorithm}
   - \usepackage{algpseudocode}
   - \usepackage{caption}
   - \captionsetup[table]{position=bottom}
   - \usepackage[utf8]{inputenc}
   - \usepackage{graphics}
   - \usepackage{amsmath}
   - \usepackage{bm}
---
# Recode to three states

\begin{columns}
\column{0.5\textwidth}
\begin{figure}[ht]
  \centering
  \resizebox{0.6\textwidth}{!}{% 
  \begin{tikzpicture}[every state/.style={minimum width={2cm} ,thick,align=center}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
  }%
\end{figure}


\column{0.4\textwidth}
\begin{figure}%[H]
    \centering
    \resizebox{0.6\textwidth}{!}{% 
    \begin{tikzpicture}[>=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
    }%
\end{figure}
\end{columns}

Steps to recode:

>- Combine states 2 and 4 into state 2
>- Write function that discards redundant rows (2 $\rightarrow$ 2)
>- Delete `from` = 3 rows
>- Expand dataset to keep censored cases
>- Delete `to` = 3 rows

原始 tikzpictures 的图像,它们之间没有箭头 这是有效的,但两个 tikz 图片之间没有箭头。

这是我按照上面提供的链接的答案尝试的,其中我尝试将图像放入一张 tikzpicture 并使用范围。

\begin{center}
\begin{tikzpicture}[every state/.style={minimum width={2cm} ,thick,align=center}]

\begin{scope}
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
\end{scope}



\begin{scope}[xshift=6cm]
    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {2:PEASY};
    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);
\end{scope}

\draw[red,->] (6,0) -- (10,0);

\end{tikzpicture}
\end{center}

由于某种原因,这些图片现在通过名为 5:ROSC 的一个节点连接。 错误的 tikzpicture 的图像

我想要两个原始的 tikzpicture,它们之间有一个箭头,最好在5:ROSC 节点的高度。

编辑 2:我添加了一张我希望箭头看起来像的图像。 图片两个 tikzpictures 之间的箭头

I want to draw an arrow from one tikzpicture to another, to include in my Beamer presentation I am making in Rmarkdown. I tried following the answer to this question: Connecting two tikz pictures with arrow. However, it does not work for me as it connects the two images together instead. This is my initial code (to make it fit with bullet points in the slide):

Edit: I have inlcuded my YAML in Rmarkdown.

---
title: "This title must be included in the first slide but is very very long"
subtitle: "Masters Thesis presentation"
institute: "My school"
author: First Last
date: March 2022
output: 
  beamer_presentation: 
    theme: "Madrid"
header-includes:
   - \AtBeginDocument{\title[short title for footline]{This title must be included in the first slide but is very very long}}
   - \usepackage{tikz}
   - \usepackage{subfig}
   - \usepackage{natbib}
   - \usetikzlibrary{automata, positioning, arrows, calc}
   - \usepackage{algorithm}
   - \usepackage{algpseudocode}
   - \usepackage{caption}
   - \captionsetup[table]{position=bottom}
   - \usepackage[utf8]{inputenc}
   - \usepackage{graphics}
   - \usepackage{amsmath}
   - \usepackage{bm}
---
# Recode to three states

\begin{columns}
\column{0.5\textwidth}
\begin{figure}[ht]
  \centering
  \resizebox{0.6\textwidth}{!}{% 
  \begin{tikzpicture}[every state/.style={minimum width={2cm} ,thick,align=center}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
  }%
\end{figure}


\column{0.4\textwidth}
\begin{figure}%[H]
    \centering
    \resizebox{0.6\textwidth}{!}{% 
    \begin{tikzpicture}[>=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
    }%
\end{figure}
\end{columns}

Steps to recode:

>- Combine states 2 and 4 into state 2
>- Write function that discards redundant rows (2 $\rightarrow$ 2)
>- Delete `from` = 3 rows
>- Expand dataset to keep censored cases
>- Delete `to` = 3 rows

Image of the original tikzpictures without arrow between them
Which works, but does not have an arrow between the two tikzpictures.

Here is what I tried following the answer of the link I provided above, where I tried putting the images into one tikzpicture and using scopes.

\begin{center}
\begin{tikzpicture}[every state/.style={minimum width={2cm} ,thick,align=center}]

\begin{scope}
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
\end{scope}



\begin{scope}[xshift=6cm]
    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {2:PEASY};
    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);
\end{scope}

\draw[red,->] (6,0) -- (10,0);

\end{tikzpicture}
\end{center}

For some reason the pictures are now connected through the one node called 5: ROSC.
Image of the wrong tikzpicture

I want the two original tikzpictures with an arrow going between them, preferrably at the height of the 5:ROSC node.

Edit 2: I have included an image of what I would like the arrow to look like. Image of arrow between the two tikzpictures

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怂人 2025-01-18 18:26:53

我建议使用 tikzmark 来完成这项工作:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{tikzmark}


\begin{document}
    
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\centering
  \begin{tikzpicture}[scale=0.6,transform shape,every state/.style={minimum width={2cm} ,thick,align=center},state/.style={circle, draw, minimum size=2cm}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {\tikzmark{foo}5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
\end{column}

\begin{column}{0.4\textwidth}
\centering
    \begin{tikzpicture}[scale=0.6,transform shape, >=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {\tikzmark{bar}2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
\end{column}
\end{columns}

\begin{tikzpicture}[remember picture,overlay]
\draw[red,->] (pic cs:foo) -- (pic cs:bar);
\end{tikzpicture}

\end{frame} 
    
\end{document}

在此处输入图像描述

(需要至少两次编译才能获得正确的坐标)


这里与 rmarkdown 相同:

---
title: "This title must be included in the first slide but is very very long"
subtitle: "Masters Thesis presentation"
institute: "My school"
author: First Last
date: March 2022
output: 
  beamer_presentation: 
    theme: "Madrid"
header-includes:
   - \AtBeginDocument{\title[short title for footline]{This title must be included in the first slide but is very very long}}
   - \usepackage{tikz}
   - \usepackage{subfig}
   - \usepackage{natbib}
   - \usetikzlibrary{automata, positioning, arrows, calc,tikzmark}
   - \usepackage{algorithm}
   - \usepackage{algpseudocode}
   - \usepackage{caption}
   - \captionsetup[table]{position=bottom}
   - \usepackage[utf8]{inputenc}
   - \usepackage{graphics}
   - \usepackage{amsmath}
   - \usepackage{bm}
---
# Recode to three states

\begin{columns}
\begin{column}{0.5\textwidth}
\centering
  \begin{tikzpicture}[scale=0.6,transform shape,every state/.style={minimum width={2cm} ,thick,align=center},state/.style={circle, draw, minimum size=2cm}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {\tikzmark{foo}5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
\end{column}

\begin{column}{0.4\textwidth}
\centering
    \begin{tikzpicture}[scale=0.6,transform shape, >=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {\tikzmark{bar}2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
\end{column}
\end{columns}

\begin{tikzpicture}[remember picture,overlay]
\draw[red,->] (pic cs:foo) -- (pic cs:bar);
\end{tikzpicture}

更新,

因为您的新草图没有显示箭头和图像之间的任何交互,只需添加第三列:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{tikzmark}


\begin{document}
    
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\centering
  \begin{tikzpicture}[scale=0.6,transform shape,every state/.style={minimum width={2cm} ,thick,align=center},state/.style={circle, draw, minimum size=2cm}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
\end{column}

\begin{column}{.1\textwidth}
\tikz\draw[blue,->] (0,0) -- (\textwidth,0);
\end{column}

\begin{column}{0.4\textwidth}
\centering
    \begin{tikzpicture}[scale=0.6,transform shape, >=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
\end{column}
\end{columns}

\end{frame} 
    
\end{document}

在此处输入图像描述

I suggest to use tikzmarks for this job:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{tikzmark}


\begin{document}
    
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\centering
  \begin{tikzpicture}[scale=0.6,transform shape,every state/.style={minimum width={2cm} ,thick,align=center},state/.style={circle, draw, minimum size=2cm}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {\tikzmark{foo}5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
\end{column}

\begin{column}{0.4\textwidth}
\centering
    \begin{tikzpicture}[scale=0.6,transform shape, >=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {\tikzmark{bar}2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
\end{column}
\end{columns}

\begin{tikzpicture}[remember picture,overlay]
\draw[red,->] (pic cs:foo) -- (pic cs:bar);
\end{tikzpicture}

\end{frame} 
    
\end{document}

enter image description here

(needs at least two compilations to get the coordinates right)


Here the same in rmarkdown:

---
title: "This title must be included in the first slide but is very very long"
subtitle: "Masters Thesis presentation"
institute: "My school"
author: First Last
date: March 2022
output: 
  beamer_presentation: 
    theme: "Madrid"
header-includes:
   - \AtBeginDocument{\title[short title for footline]{This title must be included in the first slide but is very very long}}
   - \usepackage{tikz}
   - \usepackage{subfig}
   - \usepackage{natbib}
   - \usetikzlibrary{automata, positioning, arrows, calc,tikzmark}
   - \usepackage{algorithm}
   - \usepackage{algpseudocode}
   - \usepackage{caption}
   - \captionsetup[table]{position=bottom}
   - \usepackage[utf8]{inputenc}
   - \usepackage{graphics}
   - \usepackage{amsmath}
   - \usepackage{bm}
---
# Recode to three states

\begin{columns}
\begin{column}{0.5\textwidth}
\centering
  \begin{tikzpicture}[scale=0.6,transform shape,every state/.style={minimum width={2cm} ,thick,align=center},state/.style={circle, draw, minimum size=2cm}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {\tikzmark{foo}5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
\end{column}

\begin{column}{0.4\textwidth}
\centering
    \begin{tikzpicture}[scale=0.6,transform shape, >=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {\tikzmark{bar}2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
\end{column}
\end{columns}

\begin{tikzpicture}[remember picture,overlay]
\draw[red,->] (pic cs:foo) -- (pic cs:bar);
\end{tikzpicture}

Update

As your new sketch does not show any interaction at all between your arrow and your images, just add a third column:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{tikzmark}


\begin{document}
    
\begin{frame}
\begin{columns}
\begin{column}{0.5\textwidth}
\centering
  \begin{tikzpicture}[scale=0.6,transform shape,every state/.style={minimum width={2cm} ,thick,align=center},state/.style={circle, draw, minimum size=2cm}]
  \node[state] (1) {1: DEAD};
  \node[state] at (3, 2) (3) {3:VFT};
  \node[state] at (6, 0) (5) {5:ROSC};
  \node[state] at (1.5, -3.3) (2) {2:ASY};
  \node[state] at (4.5, -3.3) (4) {4:PEA};
  
  \draw[<-] (1) -- node [midway,above] {} (2);
  \draw[<-] (1) -- node [midway,below] {} (3);
  \draw[<-] (1) -- node [midway,below] {} (4);
  \draw[<-] (1) -- node [midway,below] {} (5);
  
  \draw[<->] (2) -- node [midway,below] {} (3);
  \draw[<->] (2) -- node [midway,below] {} (4);
  \draw[<->] (2) -- node [midway,below] {} (5);
  
  \draw[<->] (3) -- node [midway,below] {} (4);
  \draw[<->] (3) -- node [midway,below] {} (5);
  
  \draw[<->] (4) -- node [midway,below] {} (5);
  \end{tikzpicture}
\end{column}

\begin{column}{.1\textwidth}
\tikz\draw[blue,->] (0,0) -- (\textwidth,0);
\end{column}

\begin{column}{0.4\textwidth}
\centering
    \begin{tikzpicture}[scale=0.6,transform shape, >=stealth', shorten >=1pt, auto, scale=1, 
    transform shape, align=center, 
    state/.style={circle, draw, minimum size=2cm}]

    \node[state] at (0,0) (5) {5:ROSC};  
    \node[state] at (3,-2) (1) {1:DEAD};
    \node[state] at (3,2) (2) {2:PEASY};

    \path[->] (5) edge node {$h_{51}$} (1)
              (5) edge node {$h_{52}$} (2)
              (2) edge node {$h_{21}$} (1)
              (2) edge [bend left] node [right] {$h_{25}$} (5);

    \end{tikzpicture}
\end{column}
\end{columns}

\end{frame} 
    
\end{document}

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文