-
Notifications
You must be signed in to change notification settings - Fork 3
/
time-rounded-box-arr+timeline+pgf+style+foreach+learn.tex
41 lines (37 loc) · 1.81 KB
/
time-rounded-box-arr+timeline+pgf+style+foreach+learn.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% https://tex.stackexchange.com/a/493707/173708
\documentclass{standalone}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\tikzdeclarecoordinatesystem{timeline}{% #1 is the date in years
\pgfmathsetmacro\myx{(#1-1975)/3}
\pgfpointxy{\myx}{0}
}
\begin{document}
\begin{tikzpicture}[line cap=rect,
event/.style={fill,
font=\tiny,
text=white,
inner sep=0.4ex,
text height=1ex,
text depth=0.4ex,
rounded corners},
bullet/.style={circle,
fill,
minimum size=4pt, % added, new
node contents={},
inner sep=1pt}]
\draw (timeline cs:1975) -- (timeline cs:2020);
\foreach \X in {1975,1980,...,2020} {
\draw (timeline cs:\X) -- ++(0,0.2) node[above,font=\tiny]{\X};}
\draw[blue!80] (timeline cs:1977) node[bullet] -- node{1977} ++ (0,-0.8) node[below,event]{A New Hope};
\draw[orange] (timeline cs:1980.4) node[bullet] -- node{1980} ++ (0,-1.6) node[below,event]{The Empire Strikes Back};
\draw[green!80!black] (timeline cs:1984) node[bullet] -- ++ (0,-0.8) node[below,event]{Return of the Jedi};
\draw[purple!80] (timeline cs:2002.5) node[bullet] -- node{2002} ++ (0,-0.8) node[below,event] (Clone) {Attack of the Clones};
\node[red,left=0.3em of Clone,event] (Phantom) {The Phantom Menace}; % set name and print movie
\draw[red] (timeline cs:1999) node[bullet] to[out=-90,in=90] (Phantom); % draw the line from bullet to label
\node[brown!80!black,right=0.3em of Clone,event] (Sith) {Revenge of the Sith}; % set name and print movie
\draw[brown!80!black] (timeline cs:2005.5) node[bullet] to[out=-90,in=90] (Sith); % draw line
\draw[pink!90!black] (timeline cs:2016) node[bullet] -- node{2016} ++ (0.2,0.8) node[above,event] {The Force Awakens};
\end{tikzpicture}
\end{document}