2

I'm trying to draw a graph (PDF output of code below attached) that's a linear process, with a potentially circular element in it.

As you may see in the upper picture, the the B,C,D elements aren't in a circle. In the lower picture, they are but the method I used seems a bit kludgy (evidenced by the arc connecting the circle nodes.

Two questions:

  1. What's a best way to draw the circle with the B, C, D nodes?
  2. How do I get that circle "subgraph"(?) to be placed with the A, E, and spectrum nodes?

Thanks in advance for your help.

\tikzstyle{stage}=[draw, circle, align=center, text width=2.5cm, minimum height=2em%]
\tikzstyle{connectR}=[->,thick]
\tikzstyle{connectA}=[->,thick]

\begin{tikzpicture}[node distance=5cm, auto]
\node (id) [stage] {A};
\node (acquire) [stage, below right of=id] {B};
\node (assess) [stage, right of=acquire] {C};
\node (assdet) [right of=assess, text width=3.5cm, node distance=4.25cm ] {Some explanation};
\node (persuade) [stage, below left of=assess] {D};
\node (optexp) [stage, below of=persuade]{E};
\node (spect) [below of=optexp, rectangle, draw, fill, left color=white, right color=gray,minimum height=1cm, minimum width=5cm] {Outcome spectrum};

\draw [connectR] (id) -- (acquire);
\draw [connectR] (acquire) -- (assess);
\draw [decorate, decoration={brace,mirror,raise=55pt}, very thick, ] (assdet.north) -- (assdet.south);
\draw[connectR,bend left] (assess.south) -- (persuade.east);
\draw[dashed, bend left] (persuade.west) -> (acquire.south);
\draw[connectR] (persuade) -- (optexp);
\draw [dashed] (optexp.south west) -- ($(spect.north west) +(.5,0)$) -- ($(spect.north east) +(-.5,0)$) -- (optexp.south east) ;

\end{tikzpicture}

\begin{tikzpicture}
\node (one)[stage] at ({145}:4cm) {B};
\node (two) [stage] at ({35}:4cm) {C};
\node (three)[stage] at ({270}:4cm) {D};
\draw [->] (one.north) to [bend left=45] (two.north);
\draw [->] (two.east) to [bend left=45] (three.east);
\draw [->, dashed] (three.west) to [bend left=45] (one.west);
\end{tikzpicture}

enter image description here enter image description here

1
  • Welcome to TeX.SX! Please help us help you by including a minimal working example (MWE) in your question. An MWE begins with \documentclass{...} and the required \usepackage's, and ends with \end{document}. It is much easier for us to help you if we can copy your example code and compile it without changing it ourselves. – eiterorm Sep 10 '14 at 21:45
3

First we draw an invisible circle node that will guide us when placing B, C and D:

\node (x) [circle,below right=6cm of id,minimum size=5.5cm,anchor=center]{};

The next step is to place BCD with respect to our x node using border anchors:

\node (acquire) [stage,fill=white] at (x.135){B};
\node (assess) [stage,fill=white] at (x.45){C};
\node (persuade) [stage,fill=white] at (x.270){D};

Finally we will draw the arrows between BCD. Since the arrow caps will not be placed at the end of the paths, we need to load the decorations.markings library and set our decoration template:

arrowmark/.style={decoration={markings,mark=at position #1 with \arrow{stealth}}}

and now we can draw the arrows:

\draw[postaction={decorate},arrowmark={.4}](x.110)to[bend left=45](x.20);
\draw[postaction={decorate},arrowmark={.9}](x.20)to[bend left=45](x.290);
\draw[dashed,postaction={decorate},arrowmark={.95}](x.250)to[bend left=45](x.160);

I'm using border anchors again to draw the arrows (almost) exactly where the invisible x circle is. You can add a draw option to x to see that we are actually following the original circle.

Full MWE

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.pathreplacing,decorations.markings,calc}

\tikzstyle{stage}=[draw, circle, align=center, text width=2.5cm, minimum height=2em]
\tikzstyle{connectR}=[->,thick]
\tikzstyle{connectA}=[->,thick]

\begin{document}

\begin{tikzpicture}[node distance=5cm, auto,arrowmark/.style={decoration={markings,mark=at position #1 with \arrow{stealth}}}]
\node (id) [stage] {A};
\node (x) [circle,below right=6cm of id,minimum size=5.5cm,anchor=center]{};
\draw[postaction={decorate},arrowmark={.4}](x.110)to[bend left=45](x.20);
\draw[postaction={decorate},arrowmark={.9}](x.20)to[bend left=45](x.290);
\draw[dashed,postaction={decorate},arrowmark={.95}](x.250)to[bend left=45](x.160);
\node (acquire) [stage,fill=white] at (x.135){B};
\node (assess) [stage,fill=white] at (x.45){C};
\node (assdet) [right of=assess, text width=3.5cm, node distance=4.25cm ] {Some explanation};
\node (persuade) [stage,fill=white] at (x.270){D};
\node (optexp) [stage, below of=persuade]{E};
\node (spect) [below of=optexp, rectangle, draw, fill, left color=white, right color=gray,minimum height=1cm, minimum width=5cm] {Outcome spectrum};

\draw [connectR] (id) -- (acquire);
\draw [decorate, decoration={brace,mirror,raise=55pt}, very thick, ] (assdet.north) -- (assdet.south);
\draw[connectR] (persuade) -- (optexp);
\draw [dashed] (optexp.south west) -- ($(spect.north west) +(.5,0)$) -- ($(spect.north east) +(-.5,0)$) -- (optexp.south east) ;

\end{tikzpicture}
\end{document}

enter image description here

3
  • Thanks! Exactly what I needed. I'll be better about MWE next time. – Nate Sep 11 '14 at 1:40
  • Where are the steps you use * to create the BCD positioning * the arrow connecting steps documented? – Nate Sep 11 '14 at 2:05
  • @Nate you may want to search the TikZ manual for "border anchor". Take also a look at this question where you can find a similar problem with some alternative approaches: tex.stackexchange.com/questions/100691/… – Old Nick Sep 11 '14 at 7:29

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.