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 make a workflow diagram like this:

enter image description here

I found TikZ, but the sequence diagram example seems a bit obscure…

share|improve this question
    
There is a tikz-uml package available that supports sequence diagrams. However, the site seems to be down at the moment. Under normal circumstances you can find it at ensta-paristech.fr/~kielbasi/tikzuml/… –  JoG Sep 5 '12 at 20:35

2 Answers 2

up vote 8 down vote accepted

You can use this as a starting point:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes}

\begin{document}

\begin{tikzpicture}[head/.style={line width=2pt,draw=gray,rounded corners=8pt,text width=2cm,align=center}]
\node[head,fill=green!60!black!50] (wd) {working directory};
\node[head,fill=yellow!40,right=of wd] (sa) {staging \\ area};
\node[head,fill=blue!40,right=of sa] (lr) {local \\ repo};
\node[head,fill=red!40,right=2cm of lr] (rr) {remote \\ repo};
\begin{scope}[line width=2pt,gray]
\foreach \box in {wd,sa,lr,rr}
  \draw ([yshift=-5pt]\box.south) -- +(0,-7cm);
\end{scope}
\begin{scope}[every node/.style={single arrow, draw=none,fill=red!50,anchor=west,align=center}]
\node [anchor=west,text width=2.8cm] at ([yshift=-1cm]wd.south) {git add};
\node [anchor=west,text width=2.8cm] at ([yshift=-2cm]sa.south) {git commit};
\node [anchor=west,text width=3.8cm] at ([yshift=-3cm]lr.south) {git push};
\node [anchor=east,text width=3.8cm,shape border rotate=180] at ([yshift=-4cm]rr.south) {git push};
\node [anchor=east,text width=6.1cm,shape border rotate=180] at ([yshift=-5cm]lr.south) {git checkout};
\node [anchor=east,text width=6.1cm,shape border rotate=180] at ([yshift=-6cm]lr.south) {git merge};
\end{scope}

\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
That's more of a finish as far as I can see :) –  percusse Sep 5 '12 at 20:39
    
Thanks, this is a very good startpoint :) –  Sanpi Sep 5 '12 at 20:56
    
+1 Two questions: Where are the shadows? Are you sure that git push goes in two opposite directions? :) –  Paul Gaborit Sep 5 '12 at 22:29
    
@PaulGaborit hehe! I missed the "git fetch" label. I'll correct it later (and perhaps I'll add the shadows). –  Gonzalo Medina Sep 5 '12 at 22:38

Almost later, but this in someway addresses the background (to be honest I played too much around arrows and colors :)).

\documentclass[svgnames]{article}

\usepackage{tikz}
\usetikzlibrary{calc,fadings,shapes.arrows,shadows,backgrounds, positioning}

\tikzset{bubble/.style={rectangle, draw=gray,rounded corners,fill=#1,align = flush center,minimum height=1cm,minimum width=1.75cm}}

\tikzfading [name=arrowfading, top color=transparent!0, bottom color=transparent!95]
\tikzset{arrowfill/.style={top color=OrangeRed!20, bottom color=Red, general shadow={fill=black, shadow yshift=-0.8ex, path fading=arrowfading}}}
\tikzset{arrowstyle/.style={draw=FireBrick,arrowfill, single arrow,minimum height=#1, single arrow,
single arrow head extend=.4cm,}}

\begin{document}

\begin{tikzpicture}
% Bubbles
\node[bubble=ForestGreen!40] (wd) at (0,0) {working\\directory};
\node[bubble=Gold!40] (sa) at (2.5,0) {staging\\area};
\node[bubble=DodgerBlue!40] (lc) at (5,0) {local repo};
\node[bubble=Tomato!40] (rc) at (8.5,0) {remote repo};

\node[above= 1 cm of rc,font={\bf}]{Remote};
\node[above= 1 cm of sa,font={\bf}]{Local};
% Lines
\foreach \bubble in {wd,sa,lc,rc}
\draw[ultra thick, gray] ($(\bubble.south)-(0,0.25)$)--($(\bubble.south)-(0,9)$);

% Arrows
\node [arrowstyle=2.5cm,xshift=-0.1cm,yshift=-1.5cm] at ($(wd.south)!0.5!(sa.south)$) {git add};
\node [arrowstyle=2.5cm,xshift=-0.1cm,yshift=-2.5cm] at ($(sa.south)!0.5!(lc.south)$) {git commit};
\node [arrowstyle=3.5cm,xshift=-0.1cm,yshift=-3.5cm] at ($(lc.south)!0.5!(rc.south)$) {git push};
\node [arrowstyle=3.5cm,xshift=0.1cm,yshift=-5cm,shape border rotate=180] at ($(rc.south)!0.5!(lc.south)$) {git fetch};
\node [arrowstyle=5cm,xshift=0.1cm,yshift=-6.5cm,shape border rotate=180] at ($(lc.south)!0.5!(wd.south)$) {git checkout};
\node [arrowstyle=5cm,xshift=0.1cm,yshift=-8cm,shape border rotate=180] at ($(lc.south)!0.5!(wd.south)$) {git merge};

% Background
\begin{pgfonlayer}{background}
\fill[gray!10]($(lc.north)!0.5!(rc.north)+(0,0.5)$)rectangle($(lc.south)!0.5!(rc.south)+(4,-9.5)$) ;
\draw[dashed, shorten <=-1.5cm] ($(lc.south)!0.5!(rc.south)$)--($(lc.south)!0.5!(rc.south)-(0,9.5)$);
\end{pgfonlayer}
\end{tikzpicture}


\end{document}

Result:

enter image description here


Another possibility to draw this kind of pictures is to exploit the pgfgantt package.

share|improve this answer
    
If you anchor your nodes from west or east you don't need to add the computations and can place them via below= 2cm of .... –  percusse Sep 5 '12 at 22:34
    
Yes, that would have been simple, but consider that when I started placing arrows I already saw @Gonzalo answer (and noticed that I incidentally copied his error with labels). That's why I tried to differentiate my answer using calc a bit since he already positioned arrows with anchors ;). –  Claudio Fiandrino Sep 6 '12 at 8:10

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.