如何创建带有特定时间点图像的 Latex 时间线

如何创建带有特定时间点图像的 Latex 时间线

我想使用乳胶创建一个时间线,但与上面的例子不同互联网,我希望我的时间轴上有代表特定时间的图像。您可以在 Paint 上查看我完美绘制的时间轴。

在此处输入图片描述

我尝试实现这一点,但是图像太小,无法将其放在时间线上:

\begin{tikzpicture}[x=3.5cm,nodes={text width=3cm,align=left}]
    \draw[black,->,thick,>=latex,line cap=rect]
      (0,0) -- (3.5,0);
    \foreach \Xc in {0,...,3}
    {
      \draw[black,thick] 
        (\Xc,0) -- ++(0,5pt);
    }
    
    \node[below,align=left,anchor=north,inner xsep=0pt,color=black] 
      at (0,0) 
      {Hint is given};  
    
    \node[below,align=left,anchor=north,inner xsep=0pt] 
      at (1,0) 
      {Robot directs correct hole with Gaze Cue};  
    
    \node[below,align=left,anchor=north,inner xsep=0pt] 
      at (2,0) 
      {Partipicant drives the screw to the correct Hole};
    
    \node[below,align=left,anchor=north,inner xsep=0pt] 
      at (3,0) 
      {\includegraphics[width=.25\textwidth]{figures/ExperimentArchitecture.png}  Robot nods its head};


\end{tikzpicture}

如下所示:

在此处输入图片描述

答案1

像这样吗?

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
    x=3.5cm,
    nodes={text width=3cm},
    image/.style={
        above,
        anchor=south,
        inner xsep=0pt,
    },
    legend/.style={
        below,
        align=left,
        anchor=north,
        inner xsep=0pt,
    },
]
    \draw[black,->,thick,>=latex,line cap=rect]
        (0,0) -- (3.5,0);
    \foreach \Xc in {0,...,3}
    {
        \draw[black,thick] 
            (\Xc,0) -- ++(0,5pt);
    }
    \draw (0,0) node[image] {\includegraphics[width=\textwidth]{example-image}};
    \draw (0,0) node[legend] {Hint is given};

    \draw (1,0) node[image] {\includegraphics[width=\textwidth]{example-image}};
    \draw (1,0) node[legend] {Robot directs correct hole with Gaze Cue}; 

    \draw (2,0) node[image] {\includegraphics[width=\textwidth]{example-image}};
    \draw (2,0) node[legend] {Partipicant drives the screw to the correct Hole};

    \draw (3,0) node[image] {\includegraphics[width=\textwidth]{example-image}};
    \draw (3,0) node[legend] {Robot nods its head};
\end{tikzpicture}
\end{document}

答案2

例如,您可以这样做(基于您的示例):

\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}[x=3.5cm,nodes={text width=3cm,align=left}]
    \draw[black,->,thick,>=latex,line cap=rect]
      (0,0) -- (3.5,0);
    \foreach \Xc in {0,...,3}
    {
      \draw[black,thick] 
        (\Xc,0) -- ++(0,5pt);
    }
    
    \node[below,align=left,anchor=north,inner xsep=0pt,color=black] 
      at (0,0) 
      {Hint is given};  
    
    \node[below,align=left,anchor=north,inner xsep=0pt] 
      at (1,0) 
      {Robot directs correct hole with Gaze Cue};  
    
    \node[below,align=left,anchor=north,inner xsep=0pt] 
      at (2,0) 
      {Partipicant drives the screw to the correct Hole};
    
    \node[below,align=left,anchor=north,inner xsep=0pt] 
      at (3,0) 
      {  Robot nods its head};

    \node[above] at (3,0) {\includegraphics[width=\linewidth]{example-image-a}};

\end{tikzpicture}
\end{document}

结果: 时间轴带上图

但是如果你没有从示例中了解到这一点,我建议学习 TikZ 基础知识以进一步了解(尤其是节点放置)。;)

相关内容