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.

3
  • 2
    Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – jub0bs
    Commented Nov 21, 2013 at 14:03
  • Okay, sorry, I added an example. Commented Nov 21, 2013 at 14:34
  • Does this help? tex.stackexchange.com/questions/103663/…
    – percusse
    Commented Nov 21, 2013 at 14:35

2 Answers 2

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];
3
  • 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. Commented Nov 21, 2013 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
    Commented Nov 21, 2013 at 15:09
  • @user1742364 I edited my answer to use anchors as starting locations
    – Federico
    Commented Nov 21, 2013 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.

1
  • That's cool, too, didn't know that. Thank you. Commented Nov 21, 2013 at 15:50

You must log in to answer this question.

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