如何在乳胶中绘制简单的甘特图?

如何在乳胶中绘制简单的甘特图?

我想绘制一个像下图这样的简单甘特图,但是我看到网上很多关于甘特图的说明比我想象的要复杂得多。 目标甘特图

答案1

一个简单的tikzpicture(不是真正的甘特图):

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[
node distance = 0pt,
G/.style = {draw, fill=gray!30, text width=2*#1mm, align=center,
            inner xsep=0pt, outer sep=0pt, 
            anchor=south west},
tck/.style = {font=\scriptsize, below}
                    ]
\foreach \n/\i [remember=\i as \j (initialy 0), 
                evaluate=\i as \k using \i-\j] in {P_4/3, P_1/9, P_3/16, P_2/24}
{
\node[G=\k]     at (\j/5,0) {$\n$};
    \node[tck]    at (\i/5,0) {\i};
\ifnum\j=0
    \node[tck]    at (0,0) {\j};
\fi
}
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容