我想在 latex 中绘制下图。我想知道这是否可以通过pgfgantt
软件包轻松实现?或者我应该使用tikz
来绘制这种图表?在 中pgfgantt
,它会产生一些顶线,这是我不希望的。此外,它还有一个像边框一样的框,而我希望图表看起来像下面这样。
谁能给我建议,我怎样才能快速做到这一点?
答案1
我可以使用 tikz 绘制一些简单的图表 -
\documentclass{article}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\begin{document}
\begin{tikzpicture}
% Axis
\draw (-0.5,0) -- (6.0,0);
\draw (0,-0.5) -- (0,3.0);
% Tasks
\node (rect) at (1,1) [draw,minimum height=0.65cm,minimum width=1cm] {$A$};
\node (rect) at (3,1) [draw,minimum height=0.65cm,minimum width=1cm] {$B_0$};
\node (rect) at (2,1) [draw,minimum height=0.65cm,minimum width=1cm] {$B_1$};
\node (rect) at (2,2) [draw,minimum height=0.65cm,minimum width=1cm] {$B_2$};
\node (rect) at (3,2) [draw,minimum height=0.65cm,minimum width=1cm] {$C_2$};
\node (rect) at (4,2) [draw,minimum height=0.65cm,minimum width=1cm] {$C_1$};
\node (rect) at (4,1) [draw,minimum height=0.65cm,minimum width=1cm] {$C_0$};
\node (rect) at (5,1) [draw,minimum height=0.65cm,minimum width=1cm] {$D_0$};
% Annotations
\node at (5.75,-0.25) {Time};
\node at (-0.35,1) {P1};
\node at (-0.35,2) {P2};
\end{tikzpicture}
\end{document}