5

I have drawn a timeline using following answer for How draw multiple timelines one after another. Is it possible to add horizontal curly braces under the timeline along with its label?

Desired sketch is as follows:

enter image description here


code for an example timeline:

\documentclass[tikz, margin=3mm]{standalone}
\usepackage{siunitx}
\usetikzlibrary{positioning,calc, arrows.meta}

\begin{document}
\begin{tikzpicture}
  \draw[->, -Latex, line width=1pt] (0,0)node(a){} -- (11,0) node (b) {} ;
  \foreach \x [count=\i] in {0,50,...,500}
  {
    \def \inBetSpace {1}
    \draw[line width=1pt] (\i*\inBetSpace-\inBetSpace,-2mm) node[below](n\i) {\x} -- ++(0,4mm);
  }
\end{tikzpicture}
\end{document}
2

1 Answer 1

6

enter image description here

\documentclass[tikz, margin=3mm]{standalone}
\usepackage{siunitx}
\usetikzlibrary{positioning,calc, arrows.meta}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}
  \draw[->, -Latex, line width=1pt] (0,0)node(a){} -- (11,0) node (b) {} ;
  \foreach \x [count=\i] in {0,50,...,500}
  {
    \def \inBetSpace {1}
    \draw[line width=1pt] (\i*\inBetSpace-\inBetSpace,-2mm) node[below](n\i) {\x} -- ++(0,4mm);
  }
\draw[decorate, decoration={brace, amplitude=6pt},] ([yshift=-1cm]2.95,0)-- node[below=0.25cm]
{Label-1}([yshift=-1cm]a.center);
\draw[decorate, decoration={brace, amplitude=6pt},] ([yshift=-1cm]9,0)-- node[below=0.25cm]
{Label-2}([yshift=-1cm]3.05,0);
\end{tikzpicture}
\end{document}

EDIT using font size \tiny and \scriptsize with font \texttt

\documentclass[tikz, margin=3mm]{standalone}
\usepackage{siunitx}
\usetikzlibrary{positioning,calc, arrows.meta}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}
  \draw[->, -Latex, line width=1pt] (0,0)node(a){} -- (11,0) node (b) {} ;
  \foreach \x [count=\i] in {0,50,...,500}
  {
    \def \inBetSpace {1}
    \draw[line width=1pt] (\i*\inBetSpace-\inBetSpace,-2mm) node[below](n\i) {\x} -- ++(0,4mm);
  }
\draw[decorate, decoration={brace, amplitude=6pt},] ([yshift=-1cm]2.95,0)-- node[below=0.25cm]
{\texttt{\tiny Label-1}}([yshift=-1cm]a.center);
\draw[decorate, decoration={brace, amplitude=6pt},] ([yshift=-1cm]9,0)-- node[below=0.25cm]
{\scriptsize Label-2}([yshift=-1cm]3.05,0);
\end{tikzpicture}
\end{document}

enter image description here

4
  • please have a look at the edit above
    – js bibra
    Mar 5, 2021 at 10:42
  • code is corrected now please
    – js bibra
    Mar 5, 2021 at 13:24
  • 1
    Thanks ! Do you use any GUI during drawing? Do you have any suggestion as book are tutorial for self-learnings?
    – alper
    Mar 5, 2021 at 16:55
  • book -- ctan.imsc.res.in/graphics/pgf/base/doc/pgfmanual.pdf -- there is no gui in latex -- self learning
    – js bibra
    Mar 5, 2021 at 23:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .