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 have 3 nodes placed on a circle. These nodes are differently shaped. I want to connect them and want the arrows to look like a circle, because it is a repeating process.

I can connect them with bend left, but that is not circle enough for me. I could mess around with in=... and out=..., but that is not a smart solution, because I would have to mess around every time I want such a picture.

Here an example code:

\documentclass{article}

\usepackage{tikz}


\begin{document}
    \begin{tikzpicture}

    % three differently shaped nodes on a circle
    \node [rectangle, draw, text width=3cm] (a) at (180:3cm) {Hello World! Hello World!};
    \node [rectangle, draw, text width=2cm] (b) at (60:3cm) {Hello World!};
    \node [rectangle, draw, text width=2cm] (c) at (300:3cm) {Hello World!};

    % connectors between the nodes
    \draw[->] (a) to [bend left] (b);
    \draw[->] (b) to [bend left] (c);
    \draw[->] (c) to [bend left] (a);

    % the circle I wish the connectors to be placed on
    \draw[dashed,red] circle [radius=3cm];

    \end{tikzpicture}
\end{document}

I would like the connectors to be placed directly on the red dashed circle. Has anyone a smarter solution than try and error with in and out?

share|improve this question
2  
I think you need smartdiagram –  Ignasi Mar 21 '13 at 18:18
    
One could use the intersections library to find the actual points where circles and border meet and connect them with an arc. That solution would be as exact as it gets but very annoying to maintain. –  Qrrbrbirlbel Mar 21 '13 at 18:46
add comment

3 Answers

Just to show how easy is with smartdiagram.

This is the code

\documentclass{article}

\usepackage{smartdiagram}

\begin{document}
\smartdiagramset{text width = 3cm, circular distance=3cm}
\smartdiagram[circular diagram]{Hello World! Hello World!, Hello World!, Hello World!}
\end{document}

and this is the result

enter image description here

It's easy but:

  • all nodes share same characteristics (text width, minimum size, ...)
  • connections are not circle enough
share|improve this answer
add comment

You can get the intersections but lower level PGF arcs make it worth doing it because then you can give start/end points of the arc. Otherwise I think JLDiaz' answer is good enough to get away. Or you simply put your nodes on a circle and place arrow heads later. But these all seem overkill to me.

\documentclass[tikz]{standalone}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}

% three differently shaped nodes on a circle
\node [rectangle, draw, text width=3cm,name path=n1] (a) at (180:3cm) {Hello World! Hello World!};
\node [rectangle, draw, text width=2cm,name path=n2] (b) at (60:3cm) {Hello World!};
\node [rectangle, draw, text width=2cm,name path=n3] (c) at (300:3cm) {Hello World!};
% the circle I wish the connectors to be placed on
\path[name path=c] circle (3cm);
\path[name intersections={of=n1 and c,name=i1},
      name intersections={of=n2 and c,name=i2},
      name intersections={of=n3 and c,name=i3}
     ];

\begin{scope}
\pgfpathmoveto{\pgfpointanchor{i1-1}{center}}
\pgfsetarrowsend{to}
\pgfpatharcto{3cm}{3cm}{0}{0}{0}{\pgfpointanchor{i2-1}{center}}
\pgfusepath{draw}
\pgfpathmoveto{\pgfpointanchor{i2-2}{center}}
\pgfpatharcto{3cm}{3cm}{0}{0}{0}{\pgfpointanchor{i3-1}{center}}
\pgfusepath{draw}
\pgfpathmoveto{\pgfpointanchor{i3-2}{center}}
\pgfpatharcto{3cm}{3cm}{0}{0}{0}{\pgfpointanchor{i1-2}{center}}
\pgfusepath{draw}
\end{scope}


\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
This is what I pointed to in my comment, though you can do it with let … in and the arc operator without the need to use PGF at all. Putting it inside a \foreach makes it a little bit easier to maintain. –  Qrrbrbirlbel Mar 21 '13 at 19:06
    
@Qrrbrbirlbel Yes I saw that after posting the answer but you need to compute the start/end angles with respect to center of the circle.Instead you copy paste 3 times. But still I think manual approach is the proper one. foreach is a good idea I forgot that. –  percusse Mar 21 '13 at 19:08
add comment

Has anyone a smarter solution than try and error with in and out?

Yes, try and error with bend left argument :-)

result

% connectors between the nodes
\draw[->] (a) to [bend left=55] (b);
\draw[->] (b) to [bend left=55] (c);
\draw[->] (c) to [bend left=55] (a);
share|improve this answer
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.