1

I would like to create a timeline by using latex, however different than the examples over the internet, I want my timeline to have images representing the certain times. You can check my perfectly drawn timeline on paint.

enter image description here

I tried to achieve this however, images were too small, and could not be able put the above the timeline:

\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}

Which looks like below:

enter image description here

  • 2
    Well if you go by the TikZ solutions, you can have \includegraphics inside nodes and you’re done. ;) – Archange Oct 16 '21 at 11:30
  • @Archange Can you post an answer plz? It should be really easy, and since there is no question similar to this one it would be helpful to others and me (At least I couldn't see any image) – Meric Ozcan Oct 16 '21 at 12:50
  • Welcome to TeX.SE! Please show us your tex code you have tried so far ... – Mensch Oct 16 '21 at 14:07
  • @Mensch First I though archange's answer was enough but it wasnt. He only showed me how to put image. But I need to orginize them. Image is on top or on down along with the text. How can I do it – Meric Ozcan Oct 16 '21 at 14:17

2 Answers2

2

Something like this?

\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}

Vincent
  • 20,157
1

You can do it like this for instance (based on your example):

\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}

Result: timelinewithpictureabove

But if you did not get to that from your example, I suggest learning TikZ basics to go further (node placement especially). ;)

Archange
  • 1,368