Make a controlled timeline in horizontal line

beamertikz-pgftimeline

I would like to use the code in this solution Controlling the highlight of dates and separation in a vertical timeline which plot a vertical timeline, to make a horizontal timeline with the same configuration possibilities such as control distance between labels, show the same date in several slides.

I have tested change the draw and I get a horizontal arrow but the labels and ticks are not well scaled along the line:

\documentclass{beamer}
\setbeamercovered{transparent}
\setbeamertemplate{navigation symbols}{} % removes navigation symbols at the bottom left
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{arrows.meta}
\tikzset{
    highlight on/.style={alt={#1{fill=red!80!black,color=red!80!black}{fill=gray!30!white,color=gray!30!white}}},
}
\begin{document}
\begin{frame}[t]{Timeline}
  \begin{columns}[b]
    \begin{column}{0.15\textwidth}
      \begin{tikzpicture}[scale=0.38,baseline={(0,-5.5)}] % baeline controla la altura del itemize
      % \draw[line width=1mm,-latex,red!20] (0,0.5) -- +(0,-17);
      \draw[line width=1mm,-latex,red!20] (0,0.5) -- +(17,0);
      \foreach \Label/\Offset/\Overlay in {2000/0/1,2001/1/2,2002/2/3,2005/5/4,2008/8/5,2009/9/6,2012/12/6,2015/15/7} {
      % el segundo num es el offset en años desde el primero
      % el tercer num sirve para poner la fecha en el mismo overlay (slide)
        \def\X{\Offset}
        \draw[highlight on=<\Overlay>,-{Latex[length=8]}] (\X,-0.5) -- (\X,-0.1);
        \node[highlight on=<\Overlay>,anchor=west,fill=white,inner sep=0pt] at (\X,0.7) {\Label};
      }
      \end{tikzpicture}
    \end{column}
    \begin{column}{0.8\textwidth}
      \begin{itemize}
      \item<1> November 2000: marmots start hibernating
      \item<2> August 2001: marmots eat
      \item<2> Semptember 2001: marmots eat
      \item<3> July 2002: marmots eat
      \item<4> May 2005: marmots awake from hibernation\
      \item<4> November 2005: marmots start hibernating again
      \item<5> May 2008: marmots drink honey liquor
      \item<6> 2009, 2012: noisy, marmots can't fall asleep
      \item<7> July 2015: marmots eat pineapple cake
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}
\end{document}

I would like the labels to appear above the line with 45 degrees of inclination.

Besides, among the years of the timeline, I would like to start the timeline in 1945 which is far to the second date 1973 and it doesn't look easy to place these dates in the same line with other dates. The rest of the dates are closer and they can appear in the line in several frames.

Best Answer

  1. To make a horizontal timeline we don't need columns.

  2. To get a longer timeline we change the picture scale.

  3. To get a 45° label inclination we use the rotate=45 node option.

!

\documentclass{beamer}
\setbeamercovered{transparent}
\setbeamertemplate{navigation symbols}{} % removes navigation symbols at the bottom left
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{arrows.meta}
\tikzset{
    highlight on/.style={alt={#1{fill=red!80!black,color=red!80!black}{fill=gray!30!white,color=gray!30!white}}},
}
\begin{document}
\begin{frame}[t]{Timeline}
  %\begin{columns}[b]
   % \begin{column}{0.15\textwidth}
      \begin{tikzpicture}[scale=0.6,
      %baseline={(0,-5.5)}
      ] % baeline controla la altura del itemize
      % \draw[line width=1mm,-latex,red!20] (0,0.5) -- +(0,-17);
      \draw[line width=1mm,-latex,red!20] (-0.5,0.5) -- +(17,0);
      \foreach \Label/\Offset/\Overlay in {2000/0/1,2001/1/2,2002/2/3,2005/5/4,2008/8/5,2009/9/6,2012/12/6,2015/15/7} {
      % el segundo num es el offset en años desde el primero
      % el tercer num sirve para poner la fecha en el mismo overlay (slide)
        \def\X{\Offset}
        \draw[highlight on=<\Overlay>,-{Latex[length=8]}] (\X,-0.5) -- (\X,-0.1);
        \node[highlight on=<\Overlay>,anchor=south,fill=white,inner sep=0pt,rotate=45] at (\X,1.25) {\Label};
      }
      \end{tikzpicture}
      \vfill
    %\end{column}
    %\begin{column}{0.8\textwidth}
      \begin{itemize}
      \item<1> November 2000: marmots start hibernating
      \item<2> August 2001: marmots eat
      \item<2> Semptember 2001: marmots eat
      \item<3> July 2002: marmots eat
      \item<4> May 2005: marmots awake from hibernation\
      \item<4> November 2005: marmots start hibernating again
      \item<5> May 2008: marmots drink honey liquor
      \item<6> 2009, 2012: noisy, marmots can't fall asleep
      \item<7> July 2015: marmots eat pineapple cake
      \end{itemize}
    %\end{column}
  %\end{columns}
\end{frame}
\end{document}

enter image description here

enter image description here

Related Question