7

I would like to draw an edge between two nodes which lies on a clip of an circle. For small angles I was able to get some more or less realistic appearance by using bend left and bend right, but for large distances, for example to connect a node which lies at 90° with an node at 225°, this is getting ugly.

However, drawing an arc alone does not draw arrows and does not end at the "borders" of the nodes, but at their center. So is there any solution, e.g. an argument for "edge" while building a path, where I can specify an arc on which it should lie?

Here is an example:

enter image description here

\documentclass{scrartcl}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\node (V1) at (0,8) {$\o{v}_1$};
\node (V3) at (4,4) {$\o{v}_2$};
\node (V5) at (0,0) {$\o{v}_3$};
\node (V6) at (-2.83,1.17) {$\o{v}_4$};

\node at (0,4) {$\o{C}$};

\path   (V1) edge[bend left=45] node[above right] {$\o{g}_1(x)$} (V3)
        (V5) edge[bend right=45] node[below right] {$\o{g}_2(x)$} (V3)
        (V5) edge[bend left=15] node[below] {$\o{g}_3(x)$} (V6)
        (V1) edge[bend right=70] node[above left] {$\o{g}_4(x)$} (V6);
\end{tikzpicture}
\end{document}

While the first three edges of the path look more or less as if the would lie on a circle, the fourth one makes the circle a potato.

6

you say:

drawing an arc alone does not draw arrows and does not end at the "borders" of the nodes, but at there center

(*their center, b.t.w.)

but it is not completely true; you can try with a workaround with arc. For example:

\draw [right, ->] (0.3,8) arc [radius=4, start angle=90, end angle= 0];

will draw an arrow from V1 to almost V2.

Playing around with the radius and the location of the nodes you can draw your circle (with arrows, see the -> above)

EDIT:

to avoid playing around with the starting location you can use node anchors:

\draw [->] (V1.east) arc [radius=4, start angle=90, end angle= 0];
  • Thanks, that helps. Is there an argument for draw which says "start the line after 3mm and stop 3mm before the target" ? That would avoid the use of approximate coordinates. – user1742364 Nov 21 '13 at 15:03
  • @user1742364 there should be. I am not the ultimate expert, but someone else might help you with the use of anchors – Federico Nov 21 '13 at 15:09
  • @user1742364 I edited my answer to use anchors as starting locations – Federico Nov 21 '13 at 15:13
5

Another arc solution:

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}
\node (V1) at (0,8) {$\o{v}_1$};
\node (V3) at (4,4) {$\o{v}_2$};
\node (V5) at (0,0) {$\o{v}_3$};
\node (V6) at (-2.83,1.17) {$\o{v}_4$};

\node at (0,4) {$\o{C}$};

\draw[-latex,shorten <= 10pt,shorten >= 10pt] (V1) arc(90:0:4cm) node[above right=3ex and .5ex] {$\o{g}_1(x)$} (V3);
\draw[-latex,shorten <= 10pt,shorten >= 10pt] (V5) arc(-90:0:4cm) node[below right=3ex and .5ex] {$\o{g}_2(x)$} (V3);
\draw[-latex,shorten <= 10pt,shorten >= 10pt] (V5) arc(270:225:4cm) node[below right=3ex and -2.5ex] {$\o{g}_3(x)$} (V6);
\draw[-latex,shorten <= 10pt,shorten >= 10pt]        (V1) arc(90:225:4cm) node[above left =1ex and 2.5ex] {$\o{g}_4(x)$} (V6);
\end{tikzpicture}
\end{document}

enter image description here

Adjust the start angle, end angle and shorten (both <= and >=) distances as per taste.

  • That's cool, too, didn't know that. Thank you. – user1742364 Nov 21 '13 at 15:50

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.