4

time line

My timeline shows all the needed information. I now want to make it look nicer, but I don't know how. I thought about colors for each "type" and a better font, e.g. \textnormal{}.

What would you recommend? Can you help me out?

\documentclass[tikz]{standalone}
\begin{document}

\begin{tikzpicture}[y=1cm, x=1cm, thick, font=\footnotesize]    
\usetikzlibrary{arrows,decorations.pathreplacing}

\tikzset{
   brace_top/.style={
     decoration={brace},
     decorate
   },
   brace_bottom/.style={
     decoration={brace, mirror},
     decorate
   }
}

% time line week
\draw[line width=1.2pt, ->, >=latex'](0,0) -- coordinate (x axis) (8,0) node[right] {Days}; 
\foreach \x in {0,...,7} \draw (\x,0.1) -- (\x,-0.1) node[below] {\x};

% top brace
\node (start_week) at (0,0.1) {};
\node (end_week) at (7,0.1) {};
\draw [brace_top] (start_week.north) -- node [above, pos=0.5] {$|T| =a~Week = 672~Periods$} (end_week.north);

% low brace
\node (start_day_u) at (3,-0.4) {};
\node (end_day_u) at (4,-0.4) {};
\draw [brace_bottom] (start_day_u.south) -- node [below, pos=0.5] {} (end_day_u.south);

% time line day
\draw[line width=1.2pt, ->, >=latex'](0,-1.5) -- coordinate (x axis) (8,-1.5) node[right] {Hours}; 
\draw (0,-1.4) -- (0,-1.6) node[below] {1};
\foreach \x in {4,8,12,16,20,24} \draw (\x/3.4,-1.4) -- (\x/3.4,-1.6) node[below] {\x};
\draw (9/3.4,-1.4) -- (9/3.4,-1.6) node[below] {9};

% top brace
\node (start_day) at (0,-1.4) {};
\node (end_day) at (7,-1.4) {};
\draw [brace_top] (start_day.north) -- node [above, pos=0.5] {$ a~Day = 96~Periods$} (end_day.north);

% low brace
\node (start_hour_u) at (8/3.4,-1.9) {};
\node (end_hour_u) at (9/3.4,-1.9) {};
\draw [brace_bottom] (start_hour_u.south) -- node [below, pos=0.5] {} (end_hour_u.south);

% time line hour
\draw[line width=1.2pt, ->, >=latex'](0,-3.0) -- coordinate (x axis) (8,-3.0) node[right] {Minutes}; 
\draw (0,-2.9) -- (0,-3.1) node[below] {1};
\foreach \x in {15,30,45,60} \draw (\x/8.5,-2.9) -- (\x/8.5,-3.1) node[below] {\x};

% top brace
\node (start_hour) at (0,-2.9) {};
\node (end_hour) at (7.05,-2.9) {};
\draw [brace_top] (start_hour.north) -- node [above, pos=0.5] {$ a~Hour = 4~Periods$} (end_hour.north);

% time line period
\foreach \x in {1,...,4} \draw[dotted] (15*\x/8.5,-3.45) -- (15*\x/8.5,-3.6) node[below] {\textbf{\x}};

% low brace period
\node (start_period) at (30/8.5,-3.9) {};
\node (end_period) at (45/8.5,-3.9) {};
\draw [brace_bottom] (start_period.south) -- node [below, pos=0.5] {$t=a~Period$} (end_period.south);

\end{tikzpicture}
\end{document}

The timeline is based on the following two examples:

Thanks leaving all this great advices!

5

I would suggest:

  1. Use siunitx for typesetting units
  2. Use colors to show the matching braces
  3. Shift the number lines so that the corresponding braces are below each other.
  4. Use densely dotted for the dots and apply a y shift so that they look more uniform.
  5. Add densely dotted lines between the corresponding parts.
  6. Horizontally extend the small braces slightly to the left and right, and also up vertically so that they are closer to the axis labels.

enter image description here

Code:

\documentclass{standalone}
\usepackage{siunitx}
\usepackage{tikz}
\usetikzlibrary{calc}

\DeclareSIUnit\periods{periods}
\DeclareSIUnit\weeks{week}
\DeclareSIUnit\days{days}
\DeclareSIUnit\hours{hours}
\DeclareSIUnit\minutes{minutes}

\begin{document}

\begin{tikzpicture}[y=1cm, x=1cm, thick, font=\footnotesize]    
\usetikzlibrary{arrows,decorations.pathreplacing}

\tikzset{number line/.style={}}

\tikzset{
   brace_top/.style={
     color=blue,
     decoration={brace},
     decorate
   },
   brace_bottom/.style={
     color=blue,
     decoration={brace, mirror},
     decorate
   }
}

\begin{scope}[xshift=0.9cm]
    \begin{scope}[xshift=-0.27cm]
        % time line week
        \draw[line width=1.2pt, ->, >=latex'](0,0) -- coordinate (x axis) (8,0) 
            node[right] {\si{\days}}; 
        \foreach \x in {0,...,7} \draw (\x,0.1) -- (\x,-0.1) node[below] {\x};

        % top brace
        \node (start_week) at (0,0.1) {};
        \node (end_week) at (7,0.1) {};
        \draw [brace_top] (start_week.north) -- node [above, pos=0.5] {$|T| = \SI[parse-numbers=false]{a}{\weeks} = \SI{672}{\periods}$} (end_week.north);

        % low brace
        \node (start_day_u) at (3,-0.4) {};
        \node (end_day_u) at (4,-0.4) {};
        \draw [brace_bottom, red] 
            ($(start_day_u.south)+(-0.3em,0.5ex)$) -- node [below, pos=0.5] {} ($(end_day_u.south)+(0.3em,0.5ex)$);
        \draw[densely dotted, red] 
            ($(start_day_u.south)!0.5!(end_day_u.south) +(0,-0.7ex)$) -- ++(0,-0.3);
    \end{scope}

    % time line day
    \draw[line width=1.2pt, ->, >=latex'](0,-1.5) -- coordinate (x axis) (8,-1.5) node[right] {\si{\hours}}; 
    \draw (0,-1.4) -- (0,-1.6) node[below] {1};
    \foreach \x in {4,8,12,16,20,24} \draw (\x/3.4,-1.4) -- (\x/3.4,-1.6) node[below] {\x};
    \draw (9/3.4,-1.4) -- (9/3.4,-1.6) node[below] {9};

    % top brace
    \node (start_day) at (0,-1.4) {};
    \node (end_day) at (7,-1.4) {};
    \draw [brace_top, red] (start_day.north) -- node [above, pos=0.5] {$ \SI[parse-numbers=false]{a}{\days} = \SI{96}{\periods}$} (end_day.north);

    % low brace
    \node (start_hour_u) at (8/3.4,-1.9) {};
    \node (end_hour_u) at (9/3.4,-1.9) {};
    \draw [brace_bottom, brown] ($(start_hour_u.south)+(-0.3em,0.5ex)$) -- node [below, pos=0.5] {} ($(end_hour_u.south)+(0.3em,0.5ex)$);
        \draw[densely dotted, brown] 
            ($(start_hour_u.south)!0.5!(end_hour_u.south) +(0,-0.7ex)$) -- ++(0,-0.3);
\end{scope}

% time line hour
\draw[line width=1.2pt, ->, >=latex'](0,-3.0) -- coordinate (x axis) (8,-3.0) node[right] {\si{\minutes}}; 
\draw (0,-2.9) -- (0,-3.1) node[below] {1};
\foreach \x in {15,30,45,60} \draw (\x/8.5,-2.9) -- (\x/8.5,-3.1) node[below] {\x};

% top brace
\node (start_hour) at (0,-2.9) {};
\node (end_hour) at (7.05,-2.9) {};
\draw [brace_top, brown] (start_hour.north) -- node [above, pos=0.5] {$ \SI[parse-numbers=false]{a}{\hours} = \SI{4}{\periods}$} (end_hour.north);

% time line period
\foreach \x in {1,...,4} \draw[densely dotted, yshift=-0.5ex] (15*\x/8.5,-3.45) -- (15*\x/8.5,-3.6) 
    node[below] {\textbf{\x}};

% low brace period
\node (start_period) at (30/8.5,-3.9) {};
\node (end_period) at (45/8.5,-3.9) {};
\draw [brace_bottom] ($(start_period.south)+(-0.3em,0)$) -- node [below, pos=0.5] {$t=\SI[parse-numbers=false]{a}{\periods}$} ($(end_period.south)+(0.3em,0)$);

\end{tikzpicture}
\end{document}
  • Are periods, week, days, hours, minutes really units? – Svend Tveskæg Nov 3 '14 at 21:37
  • @SvendTveskæg: I think that they are as they. – Peter Grill Nov 3 '14 at 21:43
  • They are somehow :) Really, really nice! Thanks. Last but not least can I do something about the "s" at the end of some units? – lony Nov 3 '14 at 21:44
  • Perhaps changing the definition in \DeclareSIUnit? Not sure exactly what you desire so am leaving it for you. – Peter Grill Nov 3 '14 at 21:50
  • 2
    That would be a good separate question on siunitx. But usually units are abbreviated to d, h etc so not normally an issue. – Peter Grill Nov 3 '14 at 21:59

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.