# How to draw an arrow in the middle of the line of a circle and how to position the arrow?

my problem ist related to TikZ: How to draw an arrow in the middle of the line?:

My Example: I like to have two circles - I want to position the arrow of circle no. 1 at south.south west of circle no. 1 and the arrow of circle no. 2 at north.north east of circle no. 2.

My personal "Hack":


\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows}
\usetikzlibrary{through}
\usetikzlibrary{automata,backgrounds}
\begin{tikzpicture}[node distance=2cm]
\begin{scope}[every node/.style={sloped,allow upside down,circle,
fill=black,inner sep=2pt}]
\node[draw,fill=white,inner sep=10pt, xshift=-0.49cm] (loop) {};
\node (n1){} ;
\node[draw,fill=white,inner sep=10pt,right of=n1,xshift=0.49cm] (loop2) {};
\node (n2) [right of=n1] {};
\end{scope}
\draw (loop)-- node {\midarrowcirc} (loop);
\draw (n1)-- node {\midarrow} (n2);
\draw (loop2)-- node {\midarrowcirc} (loop2);
\end{tikzpicture}



Unfortunately I am not able to position the arrows. Thank you for any help!

P.S. Sorry, maybe to much librarys - it is based to my trials ...

-
Is it necessary to draw the circles as nodes? Placing arrows on \draw circles is easier. –  Caramdir Dec 20 '10 at 14:51
I would be pleased to learn it - could you please give me an advice? Although I read the pgf-manual, until now I could not find out how to do it :( –  Petra Dec 20 '10 at 15:32
You forgot to paste the definitions of \midarrowcirc and \midarrow. –  Caramdir Dec 20 '10 at 16:47
–  Caramdir Dec 20 '10 at 16:48

This is how I would solve the problem (given that I understood it correctly):

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}
% draw the two circles and decorate them with arrows
\draw[
decoration={markings, mark=at position 0.625 with {\arrow{>}}},
postaction={decorate}
]
(0,0) circle (0.5);
\draw[
decoration={markings, mark=at position 0.125 with {\arrow{>}}},
postaction={decorate}
]
(3,0) circle (0.5);

% draw the connecting line
\draw[
decoration={markings, mark=at position 0.5 with {\arrow{>}}},
postaction={decorate}
]
(0.5,0) -- (2.5,0);

% draw the two black dots
\fill (0.5,0) circle (0.1);
\fill (2.5,0) circle (0.1);
\end{tikzpicture}
\end{document}


Drawing circles is described in section 14.7 “The Circle and Ellipse Operations” of the TikZ manual (all numbers refer to the v2.10 manual). The general syntax is (<center>) circle (<radius>).

The arrows are added as decorations (chapters 21 “Decorated Paths” and 30 “Decoration Library”). Specifically we add a mark in the form of an arrow at the given position. The position is given in the range [0,1] with 0 the start and 1 the end of the path. Circles always start and end at the rightmost point and are traversed counterclockwise.

As the markings decoration replaces the path with the specified path without first drawing the path, we need to first draw the circle normally and then add the decoration with a postaction (which acts on a copy of the path).

-
Yes! :) I just have to change the direction of the arrows from '>' to '<'. Thank you very much!! –  Petra Dec 20 '10 at 17:23