4

I have created a timeline with ticzpicture which looks nice (and is working) but I was wondering if there was any way to put underbraces with text below it? Here is a picture of what I mean: enter image description here

This is my code:

    \documentclass[12pt,a4paper]{article}

\usepackage{tikz}

\usetikzlibrary{timeline}

\begin{document}

\begin{tikzpicture}[timespan={}]

    \timeline[custom interval=true]{\bfseries 2014, \bfseries 2015, \bfseries 2016, \bfseries 2017, \bfseries 2018}

    \begin{phases}

            %A 2014
            \phase{between week=1 and 2 in -0.5,involvement degree=2.25cm}
            %C 2014
            \phase{between week=1 and 2 in -0.1,involvement degree=2.25cm}
            %R 2014
            \phase{between week=1 and 2 in 0.3,involvement degree=2.25cm}


            %A 2016
            \phase{between week=2 and 3 in 0,involvement degree=2.25cm,phase color=blue!80!cyan}
            %C 2016
            \phase{between week=2 and 3 in 0.4,involvement degree=2.25cm,phase color=blue!80!cyan}
            %R 2016
            \phase{between week=3 and 4 in 0.05,involvement degree=2.25cm,phase color=blue!80!cyan}



            %A 2018
            \phase{between week=3 and 4 in 0.5,involvement degree=2.25cm,phase color=green!50!black}
            %C 2018
            \phase{between week=4 and 5 in -0.1,involvement degree=2.25cm,phase color=green!50!black}
            %R 2018
            \phase{between week=4 and 5 in 1.4,involvement degree=2.25cm,phase color=green!50!black}


    \end{phases}
    %2014
            \addmilestone{at=phase-1.90,direction=90:3.5cm,text={Announcement},text options={above}}
            \addmilestone{at=phase-1.270,direction=270:1.5cm,text={Date},text options={below}}


            \addmilestone{at=phase-2.90,direction=90:2.5cm,text={Clarification},text options={above}}
            \addmilestone{at=phase-2.270,direction=270:2.5cm,text={Date},text options={below}}


            \addmilestone{at=phase-3.90,direction=90:1.5cm,text={Results},text options={above}}
            \addmilestone{at=phase-3.270,direction=270:3.5cm,text={Date},text options={below}}



        %2016

            \addmilestone{at=phase-4.90,direction=90:3.5cm,text={Announcement},text options={above}}
            \addmilestone{at=phase-4.270,direction=270:1.5cm,text={Date},text options={below}}


            \addmilestone{at=phase-5.90,direction=90:2.5cm,text={Clarification},text options={above}}
            \addmilestone{at=phase-5.270,direction=270:2.5cm,text={Date},text options={below}}


            \addmilestone{at=phase-6.90,direction=90:1.5cm,text={Results},text options={above}}
            \addmilestone{at=phase-6.270,direction=270:3.5cm,text={Date},text options={below}}


        %2018

            \addmilestone{at=phase-7.90,direction=90:3.5cm,text={Announcement},text options={above}}
            \addmilestone{at=phase-7.270,direction=270:1.5cm,text={Date},text options={below}}


            \addmilestone{at=phase-8.90,direction=90:2.5cm,text={Clarification},text options={above}}
            \addmilestone{at=phase-8.270,direction=270:2.5cm,text={Date},text options={below}}


            \addmilestone{at=phase-9.90,direction=90:1.5cm,text={Results},text options={above}}
            \addmilestone{at=phase-9.270,direction=270:3.5cm,text={Date},text options={below}}

    \end{tikzpicture}

\end{document}

Any help is gladly appreciated!:) Thanks!

  • 1
    Oops, sorry! I edited it and will check out your solution tomorrow, thank you already for the fast reply!:) @marmot – Ayla Jan 9 at 23:53
4

Something like this perhaps?

\documentclass[border = 10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{timeline}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}[timespan={}]

\timeline[custom interval=true]{\bfseries 2014, \bfseries 2015, \bfseries 2016, \bfseries 2017, \bfseries 2018}

\begin{phases}

    %A 2014
    \phase{between week=1 and 2 in -0.5,involvement degree=2.25cm}
    %C 2014
    \phase{between week=1 and 2 in -0.1,involvement degree=2.25cm}
    %R 2014
    \phase{between week=1 and 2 in 0.3,involvement degree=2.25cm}


    %A 2016
    \phase{between week=2 and 3 in 0,involvement degree=2.25cm,phase color=blue!80!cyan}
    %C 2016
    \phase{between week=2 and 3 in 0.4,involvement degree=2.25cm,phase color=blue!80!cyan}
    %R 2016
    \phase{between week=3 and 4 in 0.05,involvement degree=2.25cm,phase color=blue!80!cyan}



    %A 2018
    \phase{between week=3 and 4 in 0.5,involvement degree=2.25cm,phase color=green!50!black}
    %C 2018
    \phase{between week=4 and 5 in -0.1,involvement degree=2.25cm,phase color=green!50!black}
    %R 2018
    \phase{between week=4 and 5 in 1.4,involvement degree=2.25cm,phase color=green!50!black}


\end{phases}
%2014
    \addmilestone{at=phase-1.90,direction=90:3.5cm,text={Announcement},text options={above}}
    \addmilestone{at=phase-1.270,direction=270:1.5cm,text={Date},text options={below}}


    \addmilestone{at=phase-2.90,direction=90:2.5cm,text={Clarification},text options={above}}
    \addmilestone{at=phase-2.270,direction=270:2.5cm,text={Date},text options={below}}


    \addmilestone{at=phase-3.90,direction=90:1.5cm,text={Results},text options={above}}
    \addmilestone{at=phase-3.270,direction=270:3.5cm,text={Date},text options={below}}



%2016

    \addmilestone{at=phase-4.90,direction=90:3.5cm,text={Announcement},text options={above}}
    \addmilestone{at=phase-4.270,direction=270:1.5cm,text={Date},text options={below}}


    \addmilestone{at=phase-5.90,direction=90:2.5cm,text={Clarification},text options={above}}
    \addmilestone{at=phase-5.270,direction=270:2.5cm,text={Date},text options={below}}


    \addmilestone{at=phase-6.90,direction=90:1.5cm,text={Results},text options={above}}
    \addmilestone{at=phase-6.270,direction=270:3.5cm,text={Date},text options={below}}


%2018

    \addmilestone{at=phase-7.90,direction=90:3.5cm,text={Announcement},text options={above}}
    \addmilestone{at=phase-7.270,direction=270:1.5cm,text={Date},text options={below}}


    \addmilestone{at=phase-8.90,direction=90:2.5cm,text={Clarification},text options={above}}
    \addmilestone{at=phase-8.270,direction=270:2.5cm,text={Date},text options={below}}


    \addmilestone{at=phase-9.90,direction=90:1.5cm,text={Results},text options={above}}
    \addmilestone{at=phase-9.270,direction=270:3.5cm,text={Date},text options={below}}

    \draw [decorate, blue, decoration = {brace, amplitude = 10pt, mirror, raise = 4pt}]
    ([yshift = -5cm]phase-1.180) -- ([yshift = -5cm]phase-3.0)
    node [black, midway, yshift = -0.5cm, align = center] {Some text \\ with breaks};

    \draw [decorate, red, decoration = {brace, amplitude = 10pt, mirror, raise = 4pt}]
    ([yshift = -5cm]phase-4.180) -- ([yshift = -5cm]phase-6.0)
    node [black, midway, yshift = -0.5cm, align = center] {extra text};

    \draw [decorate, green!80!black, decoration = {brace, amplitude = 10pt, mirror, raise = 4pt}]
    ([yshift = -5cm]phase-7.180) -- ([yshift = -5cm]phase-9.0)
    node [black, midway, yshift = -0.5cm, align = center] {This phase is the best};


\end{tikzpicture}
\end{document}

enter image description here

5

Welcome to TeX.SE! The idea of this site is to exchange codes. In your post, unfortunately, the preamble is missing, meaning that those who are willing to answer have to speculate. So I guess you have downloaded the timeline library from here. Looking at the code, I have not seen any obvious way to add the braces in an elegant way without changing the library code. What one, however, always can do is to "hack" it by smuggling something into the code using every node/.append style and the like. Of course, this is more fragile than a solution that could emerge by writing the library in a different way.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{timeline,fit,decorations.pathreplacing}
\newcounter{mynode}
\tikzset{step node/.code={\stepcounter{mynode}%\typeout{\themynode}
}}
\begin{document}
\begin{tikzpicture}[timespan={},every node/.append style={step node,
alias=mynode-\themynode}]

\timeline[custom interval=true]{\bfseries 2014, \bfseries 2015, \bfseries 2016, \bfseries 2017, \bfseries 2018}

\begin{phases}

        %A 2014
        \phase{between week=1 and 2 in -0.5,involvement degree=2.25cm}
        %C 2014
        \phase{between week=1 and 2 in -0.1,involvement degree=2.25cm}
        %R 2014
        \phase{between week=1 and 2 in 0.3,involvement degree=2.25cm}


        %A 2016
        \phase{between week=2 and 3 in 0,involvement degree=2.25cm,phase color=blue!80!cyan}
        %C 2016
        \phase{between week=2 and 3 in 0.4,involvement degree=2.25cm,phase color=blue!80!cyan}
        %R 2016
        \phase{between week=3 and 4 in 0.05,involvement degree=2.25cm,phase color=blue!80!cyan}



        %A 2018
        \phase{between week=3 and 4 in 0.5,involvement degree=2.25cm,phase color=green!50!black}
        %C 2018
        \phase{between week=4 and 5 in -0.1,involvement degree=2.25cm,phase color=green!50!black}
        %R 2018
        \phase{between week=4 and 5 in 1.4,involvement degree=2.25cm,phase color=green!50!black}


\end{phases}
%2014
        \addmilestone{at=phase-1.90,direction=90:3.5cm,text={Announcement},text options={above}}
        \addmilestone{at=phase-1.270,direction=270:1.5cm,text={Date},text options={below}}


        \addmilestone{at=phase-2.90,direction=90:2.5cm,text={Clarification},text options={above}}
        \addmilestone{at=phase-2.270,direction=270:2.5cm,text={Date},text options={below}}


        \addmilestone{at=phase-3.90,direction=90:1.5cm,text={Results},text options={above}}
        \addmilestone{at=phase-3.270,direction=270:3.5cm,text={Date},text options={below}}



    %2016

        \addmilestone{at=phase-4.90,direction=90:3.5cm,text={Announcement},text options={above}}
        \addmilestone{at=phase-4.270,direction=270:1.5cm,text={Date},text options={below}}


        \addmilestone{at=phase-5.90,direction=90:2.5cm,text={Clarification},text options={above}}
        \addmilestone{at=phase-5.270,direction=270:2.5cm,text={Date},text options={below}}


        \addmilestone{at=phase-6.90,direction=90:1.5cm,text={Results},text options={above}}
        \addmilestone{at=phase-6.270,direction=270:3.5cm,text={Date},text options={below}}


    %2018

        \addmilestone{at=phase-7.90,direction=90:3.5cm,text={Announcement},text options={above}}
        \addmilestone{at=phase-7.270,direction=270:1.5cm,text={Date},text options={below}}


        \addmilestone{at=phase-8.90,direction=90:2.5cm,text={Clarification},text options={above}}
        \addmilestone{at=phase-8.270,direction=270:2.5cm,text={Date},text options={below}}


        \addmilestone{at=phase-9.90,direction=90:1.5cm,text={Results},text options={above}}
        \addmilestone{at=phase-9.270,direction=270:3.5cm,text={Date},text options={below}}
\node[fit=(mynode-17) (mynode-19) (mynode-21)] (f1){};
\draw[decorate,decoration=brace,thick] (f1.south east) -- (f1.south west)
node[midway,below]{something};
\node[fit=(mynode-23) (mynode-25) (mynode-27)] (f2){};
\draw[decorate,decoration=brace,thick] (f2.south east) -- (f2.south west)
node[midway,below]{something else};
\node[fit=(mynode-29) (mynode-31) (mynode-33)] (f3){};
\draw[decorate,decoration=brace,thick] (f3.south east) -- (f3.south west)
node[midway,below]{hibernate};
\end{tikzpicture}
\end{document}

enter image description here

Another option, yielding the same result in a less fragile way, which however requires more typing, is

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{timeline,fit,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[timespan={}]

\timeline[custom interval=true]{\bfseries 2014, \bfseries 2015, \bfseries 2016, \bfseries 2017, \bfseries 2018}

\begin{phases}

        %A 2014
        \phase{between week=1 and 2 in -0.5,involvement degree=2.25cm}
        %C 2014
        \phase{between week=1 and 2 in -0.1,involvement degree=2.25cm}
        %R 2014
        \phase{between week=1 and 2 in 0.3,involvement degree=2.25cm}


        %A 2016
        \phase{between week=2 and 3 in 0,involvement degree=2.25cm,phase color=blue!80!cyan}
        %C 2016
        \phase{between week=2 and 3 in 0.4,involvement degree=2.25cm,phase color=blue!80!cyan}
        %R 2016
        \phase{between week=3 and 4 in 0.05,involvement degree=2.25cm,phase color=blue!80!cyan}



        %A 2018
        \phase{between week=3 and 4 in 0.5,involvement degree=2.25cm,phase color=green!50!black}
        %C 2018
        \phase{between week=4 and 5 in -0.1,involvement degree=2.25cm,phase color=green!50!black}
        %R 2018
        \phase{between week=4 and 5 in 1.4,involvement degree=2.25cm,phase color=green!50!black}


\end{phases}
%2014
        \addmilestone{at=phase-1.90,direction=90:3.5cm,text={Announcement},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-1}]
        \addmilestone{at=phase-1.270,direction=270:1.5cm,text={Date},text
        options={below}}
        \end{scope}


        \addmilestone{at=phase-2.90,direction=90:2.5cm,text={Clarification},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-2}]
        \addmilestone{at=phase-2.270,direction=270:2.5cm,text={Date},text options={below}}
        \end{scope}

        \addmilestone{at=phase-3.90,direction=90:1.5cm,text={Results},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-3}]
        \addmilestone{at=phase-3.270,direction=270:3.5cm,text={Date},text options={below}}
        \end{scope}


    %2016

        \addmilestone{at=phase-4.90,direction=90:3.5cm,text={Announcement},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-4}]
        \addmilestone{at=phase-4.270,direction=270:1.5cm,text={Date},text options={below}}
        \end{scope}

        \addmilestone{at=phase-5.90,direction=90:2.5cm,text={Clarification},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-5}]
        \addmilestone{at=phase-5.270,direction=270:2.5cm,text={Date},text options={below}}
        \end{scope}

        \addmilestone{at=phase-6.90,direction=90:1.5cm,text={Results},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-6}]
        \addmilestone{at=phase-6.270,direction=270:3.5cm,text={Date},text options={below}}
        \end{scope}

    %2018

        \addmilestone{at=phase-7.90,direction=90:3.5cm,text={Announcement},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-7}]
        \addmilestone{at=phase-7.270,direction=270:1.5cm,text={Date},text options={below}}
        \end{scope}

        \addmilestone{at=phase-8.90,direction=90:2.5cm,text={Clarification},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-8}]
        \addmilestone{at=phase-8.270,direction=270:2.5cm,text={Date},text options={below}}
        \end{scope}

        \addmilestone{at=phase-9.90,direction=90:1.5cm,text={Results},text options={above}}
        \begin{scope}[every node/.append style={alias=mynode-9}]
        \addmilestone{at=phase-9.270,direction=270:3.5cm,text={Date},text options={below}}
        \end{scope}

        \node[fit=(mynode-1) (mynode-2) (mynode-3)] (f1){};
        \draw[decorate,decoration=brace,thick] (f1.south east) -- (f1.south west)
        node[midway,below]{something};
        \node[fit=(mynode-4) (mynode-5) (mynode-6)] (f2){};
        \draw[decorate,decoration=brace,thick] (f2.south east) -- (f2.south west)
        node[midway,below]{something else};
        \node[fit=(mynode-7) (mynode-8) (mynode-9)] (f3){};
        \draw[decorate,decoration=brace,thick] (f3.south east) -- (f3.south west)
        node[midway,below]{hibernate};
\end{tikzpicture}
\end{document}
  • Missing 2019 :-). Wonderful. – Sebastiano Jan 9 at 22:25
  • 1
    Amazing, as usual. Now I ask to myself: is there something that TikZ (ie. @marmot) can not do? – Sigur Jan 9 at 22:26
  • 1
    @Sigur Like getting up early during the hibernation season? – marmot Jan 9 at 22:34
  • 1
    @marmot, hibernation in theory; in fact, TikZ never sleeps. lol – Sigur Jan 9 at 22:35
  • 1
    @marmot,no problem. 9pm here and TBBT on Warner channel. – Sigur Jan 9 at 23:27

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.