Given the vertical timelines in "How can you create a vertical timeline?" and specifically this, would it be possible to make the distance between points scale with their numerical distance?
E.g. points 2000, 2005 will be half as far apart as 2010,2020

from the second link:


% code by Andrew:
% http://tex.stackexchange.com/a/28452/13304



  column 2/.append style={#1}
 timeline color/.store in=\vtmlcolor,
 timeline color=red!80!black,
 timeline color st/.style={fill=\vtmlcolor,draw=\vtmlcolor},
 use timeline header/.is if=vtimelinetitle,
 use timeline header=false,
 add bottom line/.is if=vtimebottomline,
 add bottom line=false,
 timeline title/.store in=\vtimelinetitle,
 timeline title={},
 line offset/.store in=\lineoffset,
 line offset=4pt,

\begin{tikzpicture}[column 1/.style={anchor=east},
 column 2/.style={anchor=west},
 text depth=0pt,text height=1ex,
 row sep=1ex,
 column sep=1em,
\matrix(vtimeline\thevtml)[matrix of nodes]{\BODY};
\path[timeline color st] 
($(vtimeline\thevtml-1-1.north east)!0.5!(vtimeline\thevtml-1-2.north west)$)--
($(vtimeline\thevtml-\endmtx-1.south east)!0.5!(vtimeline\thevtml-\endmtx-2.south west)$);
\foreach \x in {1,...,\endmtx}{
 \node[circle,timeline color st, inner sep=0.15pt, draw=white, thick] 
 (vtimeline\thevtml-c-\x) at 
 \draw[timeline color st](vtimeline\thevtml-c-\x.west)--++(-3pt,0);
  \draw[timeline color st]([yshift=\lineoffset]vtimeline\thevtml.north west)--
  ([yshift=\lineoffset]vtimeline\thevtml.north east);
   at (vtimeline\thevtml-1-1.north west) 
   {\textsc{Timeline \thevtml}: \textit{\vtimelinetitle}};
   \draw[timeline color st]([yshift=-\lineoffset]vtimeline\thevtml.south west)--
  ([yshift=-\lineoffset]vtimeline\thevtml.south east);


\begin{vtimeline}[timeline color=cyan!80!blue, add bottom line, line offset=2pt]
1947 & AT and T Bell Labs develop the idea of cellular phones\endlr
1968 & Xerox Palo Alto Research Centre envisage the `Dynabook'\endlr
1971 & Busicom 'Handy-LE' Calculator\endlr
1973 & First mobile handset invented by Martin Cooper\endlr
1978 & Parker Bros. Merlin Computer Toy\endlr
1981 & Osborne 1 Portable Computer\endlr
1982 & Grid Compass 1100 Clamshell Laptop\endlr
1983 & TRS-80 Model 100 Portable PC\endlr
1984 & Psion Organiser Handheld Computer\endlr
1991 & Psion Series 3 Minicomputer\endlr

  • I used the solution here: vertical timeline tikz clash with beamer poster
    – Una
    Sep 20, 2020 at 23:29
  • Honestly I wish I could combine the two. Torbjørn T's is prettier but I wish I could manipulate the lines for when entries are very close to one another.
    – SKNB
    Sep 22, 2020 at 18:17

1 Answer 1


That specific approach uses a \matrix to lay out the timeline, so it's not straightforward to adjust the row spacing as you want to. A different approach would be to use pgfplots and make the timeline with an actual plot. The text can be added with nodes near coords.

I haven't tried wrapping this in a macro/environment as in the post you refer to, but I can try doing that tomorrow, if you want to.


\pgfplotstableread[col sep=semicolon]{
year ; label
1947 ; AT and T Bell Labs develop the idea of cellular phones 
1968 ; Xerox Palo Alto Research Centre envisage the `Dynabook'
1971 ; Busicom 'Handy-LE' Calculator 
1973 ; First mobile handset invented by Martin Cooper 
1978 ; Parker Bros. Merlin Computer Toy 
1981 ; Osborne 1 Portable Computer 
1982 ; Grid Compass 1100 Clamshell Laptop 
1983 ; TRS-80 Model 100 Portable PC 
1984 ; Psion Organiser Handheld Computer 
1991 ; Psion Series 3 Minicomputer

  y dir=reverse,
  hide x axis,
  axis y line=left,
  axis line style={-, draw=none},
  nodes near coords,
  nodes near coords align=right,
  point meta=explicit symbolic,
  yticklabel style={
    /pgf/number format/set thousands separator={},
    inner sep=1pt
  scale only axis,
  tick align=outside,
  every tick/.append style={thin, cyan}
  \addplot [mark=*,cyan,mark size=2, shorten <=-2mm, shorten >=-2mm, thick] table[y index=0, x expr=1, meta=label] {\datatable};


enter image description here

  • It's pretty near perfect for what I'm looking for. And it helps me wrap my head around the enigma that is tikz/pgf, so thanks a million (: My only question(s): is there a way to extend a line like @Una's answer for only some entries (i.e. when two entries are so close to one another that they'd overlap)? And is there a way to break long entries into two lines (i.e. 1 point but 2 right-hand line)? I'm using this for a daily 24h log, and entries are often within 5 minutes of each other. Which even with the timeline spanning the full vertical height of the page still overlaps.
    – SKNB
    Sep 22, 2020 at 18:16
  • I'll just mark it as solved in any event
    – SKNB
    Sep 22, 2020 at 18:18
  • 1
    @SKNB For line breaking, if you add nodes near coords style={anchor=mid west, align=left}, to the axis options you can use \\ in the data file to add line breaks manually. Alternatively, text width=8cm (or some other suitable length) instead of align=left, for automatic line breaking. Don't have a solution for the other problem, it's probably possible, but would take some work. Sep 22, 2020 at 18:27

You must log in to answer this question.

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