1

I would like to draw following picture in latex. I would like to have a suggestion if this could be easily possible by pgfgantt package? Or should I use tikz to draw this kind of diagram? In pgfgantt, it is produce some top line, which I would not like to have. Plus in addition it has a box like borders, whereas I would prefer the diagram to look like below.

Can anyone give me suggestion, how can I do this quickly?

enter image description here

1
  • Have a look at this. – user10274 Mar 28 '13 at 11:28
3

I could draw some simple diagram using 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}
2
  • 3
    I suggest that you also make a minimal working example (MWE) for an answer, a compilable code starting with \documentclass{...} and ending with \end{document}. Also, you can shorten the code by using \foreach – hpesoj626 Mar 28 '13 at 10:33
  • In addition to hpesoj626 comment, you can also use styles in order to not repeat any time the options draw,minimum height=0.65cm,minimum width=1cm. – Claudio Fiandrino Mar 28 '13 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.