# how to add arrow between arrows, how to put an arrow on a second arrow

I have big problems to get model of evolution. I do not even know how to start.

If some one show the sample code of something similar, I would be grateful

\documentclass{minimal}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols}
\usepackage{xcolor}
\tikzset{
W/.style={
rectangle,
rounded corners=4pt,
draw=black, thin,
text width=10em,
minimum height=3em,
P/.style={
circle,
draw=blue!50!black!50,
top color=white,
bottom color=blue!60!black!10,
inner sep=5pt,
text width=1.75cm,
minimum height=3em,
}
}
\definecolor{vert}{rgb}{0.15 0.4 0.1}
\definecolor{bleu}{rgb}{0.39, 0.58, 0.93}

\begin{document}

\begin{tikzpicture}

\node[P] (p) {P};
\node[W, below= 3cm of p](w) {W};

\draw[transform canvas={xshift=2ex},->] (p.south) --  ++(0,0) -|     (w.north);
\draw[transform canvas={xshift=-2ex},->] (w.north) -- ++(0,0) -|  (p.south);
\draw[->, dashed,transform canvas={xshift=-2ex},very thick] (w.north) -- ++(0,0) -|  (p.south);
\end{tikzpicture}
\\
\begin{tikzpicture}
\node[at={(0,0)},text=bleu]{\bfseries Objaśnienia};
opacity=0.5,text=bleu]{\bfseries Objaśnienia};
\end{tikzpicture}
\begin{itemize}
\item[] \tikz {\path[circle, top color=white,
bottom color=blue!60!black!10,]
(0,0) -- (1,0) node[above,pos=0.5,text=vert] {P};} -- frakcja populacji P, która się adaptuje

\item[] \tikz {\path[line width=2pt,->,dashed]
(0,0) -- (1,0) node[above,pos=0.5,text=violet] {W};} some text,
$S_i\,\longrightarrow\,T_j$ non radiative transition.

\end{itemize}
\end{document}


-

The way to do this is like almost any other piece of software, break it down into its components.

## Major Components:

First is the circle, which is pretty easy:

\draw (0,0) circle (1cm) node {\Huge P};


But since we are going to be interconnecting them, perhaps a node would be better:

\node [draw=black, circle] at (0cm,0cm) {\Huge P};


Oh, and might as well name this node (MyCircle), and perhaps add some inner sep to make the circle larger:

\node [draw=black, circle, inner sep=0.25cm] (MyCircle)  {\Huge P};


The shading is a detail that can be addressed later. The rectangle can be draw similarly:

\node [draw=black, rectangle, inner sep=0.25cm] (MySquare) at (0cm,-2cm) {\Huge W};


Perhaps we should add some more space between the circle and square by moving it lower:

\node [draw=black, rectangle, inner sep=0.25cm] (MySquare) at (0cm,-3cm) {\Huge W};


Now we can draw the vertical lines connecting the two nodes (thanks percusse):

\draw [red,  ->] (MyCircle.-115) -| (MySquare.120);
\draw [blue, ->] (MySquare.55)   -| (MyCircle.-60);


which yields:

Ok, so now you have the main components of the diagram:

\begin{tikzpicture}[thick]
\node [draw=black, circle,    inner sep=0.25cm] (MyCircle) at (0cm,0cm)  {\Huge P};
\node [draw=black, rectangle, inner sep=0.25cm] (MySquare) at (0cm,-3cm) {\Huge W};

\draw [red,  ->] (MyCircle.-115) -| (MySquare.120);
\draw [blue, ->] (MySquare.55)   -| (MyCircle.-60);
\end{tikzpicture}


## Horizontal Lines

Since there is quite a bit of repetition going on with the horizontal arrows, I'd use a \foreach loop to iterate over them. Need to decide how far apart you want them. So something like:

\foreach \y in {-1,-1.25,...,-3.0} {%
\draw [brown,-latex] (1,\y) -- (0,\y);
}%


where I changed the arrow style to -latex which yields:

Now we can draw the arrows on the left going the other way:

\foreach \y in {-1,-1.5,...,-3.0} {%
\draw [violet,-latex] (-1,\y) -- (0,\y);
}%


If you want more of the brown arrows, we need to reduce the spacing in between them. So something like:

\foreach \y in {-1,-1.167,...,-3.167} {%
\draw [brown,-latex] (1,\y) -- (0,\y);
}%

\foreach \y in {-1,-1.5,...,-3.0} {%
\draw [violet,-latex] (-1,\y) -- (0,\y);
}%


Now to add the numbers on the left hand side we can use a node at the midway part of the line, and above it. We can use the [count=\i] to automatically determine the value to be placed above it. So, with:

\begin{tikzpicture}[thick]
\foreach \y in {-1,-1.167,...,-3.167} {%
\draw [brown,-latex] (1,\y) -- (0,\y);
}%

\foreach [count=\i] \y in {-1,-1.5,...,-3.0} {%
\draw [violet,-latex] (-1,\y) -- (0,\y)
node [midway, above] {\i};
}%
\end{tikzpicture}


we get:

Now just need to find a method to convert these to roman numbers.

Putting these pieces into one figure should get you quite far along to the final drawing.

## Braces:

To draw the braces you should refer to Adding a large brace next to a body of text, or perhaps the numerous answers I have posted here using \tkzmark.

-
+1 You just started a new tutorial... ;-) – Paul Gaborit Sep 15 '12 at 10:14
@PaulGaborit: Yeah, its a sequel to How to draw a poset Hasse Diagram using TikZ?. – Peter Grill Sep 15 '12 at 10:17
You could use a counter for the roman numbers: \newcounter{myroman} \renewcommand{\themyroman}{\Roman{myroman}} \foreach [count=\i] \y in {-1,-1.5,...,-3.0} { \setcounter{myroman}{\i} \draw [violet,-latex] (-1,\y) -- (0,\y) node[midway, above] {\themyroman}; }. As the numbers increase by one, one could also use \stepcounter – Tom Bombadil Sep 15 '12 at 21:03
@TomBombadil: Yep, that would work great. But since that was not the main thrust of the question I thought I'd leave that as an open issue here. – Peter Grill Sep 17 '12 at 9:22
Thank You Peter Grill! – Daniel Miliński Oct 25 '12 at 10:02