Tikz 绘制感染的时间线进展

Tikz 绘制感染的时间线进展

在此处输入图片描述

您好,我想问一下是否有人可以帮我画一下这个时间线图。非常感谢您的帮助。

答案1

这里是:

结果

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}


\begin{document}

\begin{tikzpicture}[scale=1]
\node[align=center] at (1,0.5) {Susceptible\\stage};
\node[align=center] at (2.25,1.85) {Time of\\infection};
\draw [thick,->] (2.25,1.4) -- (2.25,0.15);
\node[align=center] at (3.15,0.85) {Latent\\period};
\draw [thick,decorate,decoration={brace,amplitude=6pt,raise=0pt}] (2.5,0.15) -- (3.75,0.15);
\draw [thick,->] (4,0.85) -- (4,0.15);
\node[align=center] at (6.25,0.6) {Infectious period};
\draw [thick,->] (8.25,0.85) -- (8.25,0.15);
\node[align=center] at (9.15,0.5) {Immune\\stage};
\draw [thick,decorate,decoration={brace,amplitude=6pt,raise=0pt}] (4.25,0.15) -- (8,0.15);
\draw [thick,->] (0,0) -- (10,0);
\draw [thick,->] (4.6,-0.85) -- (4.6,-0.15);
\draw [thick,->] (7.65,-0.4) -- (7.65,-0.15);
\draw [thick,decorate,decoration={brace,amplitude=6pt,raise=0pt,mirror}] (4.75,-0.15) -- (7.5,-0.15);
\node[align=center] at (6.25,-0.85) {Symptomatic\\period};
\node[align=center] at (4.6,-1.3) {Onset of\\symptoms};
\end{tikzpicture}

\end{document}

答案2

准备好一些绘图元素后,就可以编写相对紧凑的时间线代码了:

\documentclass{article}
    \usepackage{tikz}
\usetikzlibrary{arrows,positioning,decorations.pathreplacing}

    \begin{document}
\begin{tikzpicture}[
    every node/.style = {align=center},
          Line/.style = {-angle 90, shorten >=2pt},
    Brace/.style args = {#1}{semithick, decorate, decoration={brace,#1,raise=2pt,
                             pre=moveto,pre length=2pt,post=moveto,post length=2pt,}},
            ys/.style = {yshift=#1}
                    ]
\linespread{0.8}                    
\coordinate (a) at (0,0);
\coordinate[right=22mm of a]    (b);
\coordinate[right=16mm of b]    (c);
\coordinate[right= 5mm of c]    (d);
\coordinate[right=24mm of d]    (e);
\coordinate[right= 5mm of e]    (f);
\coordinate[right=22mm of f]    (g);

\draw[Line] (a) -- node[above] {Susceptible\\stage}    (b) -- (f)
                -- node[above] {Immune\\stage}         (g) node[below left] {time};
\draw[Brace] (b) -- node[above=3pt] {Latent\\period}(c);
\draw[Brace] (c) -- node[above=3pt] {Infectious period} (f);
\draw[Brace=mirror] (d) -- node[below=3pt] {Symptomatic\\period} (e);
\draw[Line] ([ys=11mm] b) node[above] {Time of\\infection} -- (b);
\draw[Line] ([ys=7mm]  c) -- (c);
\draw[Line] ([ys=7mm]  f) -- (f);
\draw[Line] ([ys=-11mm] d) node[below] {Onset of\\symptoms} -- (d);
\draw[Line] ([ys=-7mm]  e) -- (e);
\end{tikzpicture}
    \end{document}

在此处输入图片描述

如果您不喜欢确定时间线的坐标,您可以(a)使用(0,0)等等。

相关内容