2

I have a tikz graph with bend arrows and somehow tikz draws the arrow annotation (in my case just numbers) on the arrow. This happens a lot more often when the arrow is bend. It seems that tikz has no knowledge of where the annotation is with respect to the arrow. I have the self-contained code below. What I want is that annotations are above the bending and also I want to have a minimum distance (in pixel?) to the arrow that I can control. Is there something like that in Tikz?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.5cm,
  thick,main node/.style={circle,fill=blue!10,draw,font=\sffamily\Large\bfseries}]

    % nodes
    \node[main node] (A) {A};
    \node[main node] (B) [below left of=A] {B};
    \node[main node] (C) [below right of=A] {C};
    \node[main node] (D) [below right of=B] {D};
    \node[main node] (E) [right of=C] {E};
    \node[main node] (F) [above of=E] {F};

    % lines
    \path[every node/.style={font=\sffamily\small}]
       (A) edge [bend right] node [right] {0.0} (B)
       (B) edge [loop left] node {0.0} (B)
           edge [bend right] node [right] {0.0} (D)
           edge [bend right] node[right] {0.0} (C)
       (C) edge [bend right] node [left] {0.0} (A)
           edge [bend right] node [left] {0.0} (B)
           edge [bend left] node [left] {0.0} (D)
           edge [right] node [right] {0.0} (E)
       (D) edge [loop below] node {0.0} (D);
\end{tikzpicture}

\end{document}
3

I just replaced some "right" and "left" to "above" and "below"

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.5cm,
  thick,main node/.style={circle,fill=blue!10,draw,font=\sffamily\Large\bfseries}]

    % nodes
    \node[main node] (A) {A};
    \node[main node] (B) [below left of=A] {B};
    \node[main node] (C) [below right of=A] {C};
    \node[main node] (D) [below right of=B] {D};
    \node[main node] (E) [right of=C] {E};
    \node[main node] (F) [above of=E] {F};

    % lines
    \path[every node/.style={font=\sffamily\small}]
       (A) edge [bend right] node [right] {0.0} (B)
       (B) edge [loop left] node {0.0} (B)
           edge [bend right] node [right] {0.0} (D)
           edge [bend right] node[below] {0.0} (C)
       (C) edge [bend right] node [right] {0.0} (A)
           edge [bend right] node [above] {0.0} (B)
           edge [bend left] node [left] {0.0} (D)
           edge [right] node [above] {0.0} (E)
       (D) edge [loop below] node {0.0} (D);
\end{tikzpicture}

\end{document}

enter image description here

| improve this answer | |

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.