如何绘制时间线?

如何绘制时间线?

如何绘制这样的东西?

在此处输入图片描述

答案1

一个选项是使用TikZ

\documentclass{article} 
\usepackage{tikz}
\usepackage{amsmath}

\definecolor{mygreen}{RGB}{117,167,117}
\definecolor{myred}{RGB}{255,1,1}

\newcommand\myent[3]{%
\footnotesize%
$\begin{array}{@{}r@{}} 
#1 \\ #2 \\#3
\end{array}$%
}

\begin{document}

\begin{tikzpicture}[x=1.5cm]
\draw[mygreen,->,thick,>=latex]
  (0,0) -- (5,0) node[below right] {$\scriptstyle t$};
\foreach \Xc in {0,...,4}
{
  \draw[mygreen,thick] 
    (\Xc,0) -- ++(0,5pt) node[above] {$\scriptstyle \Xc$};
}
\foreach \Xc/\Texto in {1/Load,2/Escape,3/Shoot}
{
  \fill[myred] 
    ([xshift=5pt]\Xc,0.25)  
      rectangle node[above] {\strut\small\Texto} 
    ([xshift=-5pt]\Xc+1,0.35);  
}
\node[below,align=left,anchor=north,inner xsep=0pt,color=myred] 
  at (0,0) 
  {\myent{a}{\neg l}{\neg h}};  
\node[below,align=left,anchor=north,inner xsep=0pt] 
  at (1,0) 
  {\myent{a?}{l?}{h?}};  
\node[below,align=left,anchor=north,inner xsep=0pt] 
  at (2,0) 
  {\myent{a?}{\color{myred}l\ast}{h?}};  
\node[below,align=left,anchor=north,inner xsep=0pt] 
  at (3,0) 
  {\myent{a?}{l?}{\color{myred}h\ast}};  
\node[below,align=left,anchor=north,inner xsep=0pt] 
  at (4,0) 
  {\myent{a?}{\color{myred}\neg l\ast}{h?}};  
\end{tikzpicture}

\end{document}

结果:

在此处输入图片描述

相关内容