10

For the MWE below:

\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath, graphicx, tikz, enumerate, amssymb, pgf}

\usepackage{setspace}
\usepackage{pgfplots}
%\usepackage{slashbox} Used in original larger file
\usepackage{bchart}

\raggedbottom
\usepackage[bottom]{footmisc}

\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols,automata}

\begin{document}



\setcounter{page}{1}
\renewcommand{\thepage}{\arabic{page}}
\singlespace

\begin{center}
\begin{tikzpicture}[->,>=stealth', auto,node distance=6cm,
  thick,main node/.style={circle,fill=blue!20,draw,font=\sffamily\Large\bfseries}]

  \node[main node] (1) {Design};
  \node[main node] (2) [below left of=1] {Implement};
  \node[main node] (3) [right of=2] {Test};
  \node[main node,dashed, left of =1,fill=white] (4) {\parbox{4cm}{\centering Initial Design\&\\ Implementation}};

  \path[every node/.style={font=\sffamily\small}]
    (4) edge [bend left] node[left] {} (1)
    (1) edge [bend right] node[left] {} (2)
    (2) edge [bend right] node[right] {} (3)
    (3) edge [bend right] node[right] {} (1);
\end{tikzpicture}
\end{center}

\end{document}

I want to group the blue circles possibly with a brace ("}") saying for each method how can I do that ? and I guess what's a good looking way to do achieve this ?

enter image description here

2
  • In your MWE, the slashbox package is it really useful? Aug 26, 2012 at 16:41
  • no but since I got this snippet from a bigger latex file I forgot to take it out.. For the original file, yes it is useful
    – Cemre
    Aug 26, 2012 at 16:44

1 Answer 1

16

(Remark: if you use the positioning library, use left=of ... syntax instead of left of=... syntax.)

To group some nodes, you can use the fit library.

To make a big brace, you can use decorations.pathreplacing library.

Here is a proposition:

enter image description here

and the code (with some comments):

\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{trees,positioning,fit,arrows,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
  \tikzset{main node/.style={
      circle,fill=blue!20,draw,font=\sffamily\Large\bfseries,
    }}

  \begin{scope}[node distance=6cm]
    \node[main node] (1) {Design};
    \node[main node] (2) [below left=of 1] {Implement};
    \node[main node] (3) [right=of 2] {Test};

    \node[main node,text width=4cm, align=flush center, dashed,
    left=of 1,fill=white] (4)%
    {Initial Design\\\&\\ Implementation};
  \end{scope}

  \begin{scope}[->,>=stealth',auto]
    \path[every node/.style={font=\sffamily\small}]
    (4) edge [bend left] node[left] {} (1)
    (1) edge [bend right] node[left] {} (2)
    (2) edge [bend right] node[right] {} (3)
    (3) edge [bend right] node[right] {} (1);
  \end{scope}

  % grouping blue nodes
  \node[fit=(1)(2)(3)](group){};

  % comment below
  \draw[line width=1pt,red,decorate,decoration={amplitude=7pt,brace,mirror}]
  (group.south west) -- (group.south east);
  \node[below=of group,anchor=center]{Comment... below.};

  % comment right 
  \draw[line width=1pt,orange,decorate,decoration={amplitude=7pt,brace}]
  (group.north east) -- (group.south east);
  \node[right=of group,anchor=center,rotate=90]{Comment... right.};
\end{tikzpicture}
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .