Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
Have a look at this. –  Marc van Dongen Mar 28 '13 at 11:28
add comment

1 Answer 1

up vote 1 down vote accepted

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}
share|improve this answer
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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