I would like to reproduce a lot of time line charts with a style similar to the image below.

The charts would show how different events in history are related to each other in time.

I would like to also include text to the left of each row as well for the event plotted on the timeline.

I’ve never used Tikz, (or pgfgantt). Would this be difficult to create with LaTeX code with one of these ? enter image description here

2 Answers 2


Here is an automated solution. Define a new command called \timeline that has 6 arguments, one optional. The syntax is


<label> is "A.D." in your example. <start> is the start year after <label>: 30 in your example. <step> is the number of years between labeled years: 5 in your example. <number> is the number of labeled years, which is 11 in your example.

<eventspace> is the length (in cm) allotted for the events on the left. The default is 2.

<intervals> is a comma separated list where each entry has the form begin/end/event. event can be empty.

For example, the code

\timeline[2.5]{A.D.}{30}{5}{11}{29/33/event 1,32/34.5/event 2,35.5/38/something,44/48/??,45.5/48/X,47/49.5/Y,47.5/52/Z,52/57.5/,61.5/63/,64/67/A}

produces the output

enter image description here

Here is the complete code:


\definecolor{linecolor}{rgb}{0, 0.5, 0.5}

    \node[anchor=base] at (0,.15){\textsf{\textbf{\scriptsize#2}}};
    \foreach [var=\n, evaluate=\n as \l using int(\n*#4+#3-#4)] in {1,...,#5}{
        \node[anchor=base] at (\n,.15){\textsf{\textbf\l}};}
    \foreach [var=\timea, var=\timeb, var=\event, count=\n] in {#6}{
        \fill[color=\col!15](-#1,-\n+1) rectangle (#5+1,-\n);
        \foreach \m in {0,...,#5}{\draw[linecolor](\m,-\n+1)--(\m,-\n);}
        \fill[linecolor,rounded corners=1.5mm]({(\timea-#3+#4)/#4},-\n+.65) rectangle ({(\timeb-#3+#4)/#4},-\n+.35);
        \node[anchor=base, right] at (-#1,-\n+.5) {\textsf{\textbf\event}};}
    \foreach [var=\timea, var=\timeb, count=\n] in {#6}{\draw[linecolor](-#1,-\n)--(#5+1,-\n);}


\timeline[2.5]{A.D.}{30}{5}{11}{29/33/event 1,32/34.5/event 2,35.5/38/something,44/48/??,45.5/48/X,47/49.5/Y,47.5/52/Z,52/57.5/,61.5/63/,64/67/A}

  • Wow @Sandy G !!! Perfect!!! I'm blown away !!! This perfectly answered my question !!! (Excellent colors too!!). How do I give you credit for this answer ? (I'll study what you've done here ... is it easy to make modifications whereby the row labels are also included into the alternating colored rows ? This is awesome. I'm going to have to learn Tikz
    – RichWalt
    Jan 3, 2022 at 14:56
  • Yes, it's an easy modification. I'll edit my response shortly.
    – Sandy G
    Jan 3, 2022 at 16:00
  • Thank you so very much !!! I am going after left-justified text within a "first column" of the chart - if possible. I would have included the complete pic if it were not for copyright issues. ( I am learning by making some basic modifications - afterwards ... I'll read the manual ... lol). I have no problem donating a nice tip for a cup of coffee !
    – RichWalt
    Jan 3, 2022 at 16:32
  • I edited my response. As for credit, if you are writing a paper or book you can include my name (Sandy Ganzell) in an acknowledgement/footnote/endnote if you wish, but it is not necessary. My post here is public and can be used freely without credit (except within this site, see this help page).
    – Sandy G
    Jan 3, 2022 at 19:39
  • Perfect !!! Thank You !
    – RichWalt
    Jan 3, 2022 at 19:47

Using pgfgantt:

Edit: the best I could come up with for now is this:

\begin{ganttchart}[hgrid, vgrid]{30}{84}
title/.append style=
  ]{30,35,...,80}{5} \\

I know this is not quite what you are looking for but I hope it will help.

Gantt chart

  • I saw this package. Very nice. If the time labels are in units of 10s … I.e 20, 30, 40, 50, etc. Is there a way to refine the marks to precision? Like from 44 to 52? This looked like it may be limited to the exact boundaries, which would defeat the purpose. This would be great if it were not limited to the exact boundaries.
    – RichWalt
    Jan 1, 2022 at 17:49

You must log in to answer this question.

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