3

I am trying to make I diagram with two boxes, one above the other, and two arrows: I would like the arrows to be curved (that would be kind of circular flow diagram) and in just one direction. Although, the best I could do searching by myself was one single straight bidirectional vertical arrow. Could someone help me with that ?

Edit

Also I would like to know about other types of arrows. I am looking for a thiker solid one but I couldn't find any yet. Could someone point me in the right direction please?

Extra question

How to make the text next to the arrows lay in the horizontal?

The code I used is that one :

\begin{document} 
\usepackage{color, colortbl} 
\usepackage{tikz}  
\usetikzlibrary{arrows,positioning,shapes,backgrounds,fit}  
\begin{figure}[ht]
 \centering
        \scalebox{.8}{
        \begin{tikzpicture}[
        node distance= 9em and 4em,
        sloped]
        \tikzset{
        box/.style = {
            fill=blue!15,
            shape=rectangle, 
            rounded corners,
                draw=blue!40, 
                align=center,
                %minimum size={10pt},
                text = black,
                font=\fontsize{12}{12}\selectfont},
        dummybox/.style = {
            shape=circle,  
                align=center, 
                minimum size={width("rrrrrrrrrrr")+2pt}},
        arrow/.style={
            color=black,
            draw=blue,
            -latex,
                font=\fontsize{8}{8}\selectfont},
        }

        \node[box](B1){Node $A$};
        \node[box, below = of B1](S1){Node $B$};
        \draw[arrow](B1) to node[above]{Flow: $\alpha$ } (S1);

        \draw[arrow](S1) to node[above]{Flow: $-\beta$ } (B1);
\end{tikzpicture}}
\end{figure} 
\end{document}
  • 1
    Pleas, complete your code to small complete document, which we can copy to our computer and test then. – Zarko Jul 22 '16 at 12:57
  • And preamble? Used package should be loaded in it. ... – Zarko Jul 22 '16 at 13:26
3

Edit: Alternatively:

enter image description here

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows.meta, positioning}

\begin{document}
    \begin{tikzpicture}
\tikzset{
node distance = 9em and 4em,
sloped,
   box/.style = {%
    shape=rectangle,
    rounded corners,
    draw=blue!40,
    fill=blue!15,
    align=center,
    font=\fontsize{12}{12}\selectfont},
 arrow/.style = {%
    draw=blue!30,
    line width=2mm,% <-- select desired width
    -{Triangle[length=3mm]},
    shorten >=1mm, shorten <=1mm,
    font=\fontsize{8}{8}\selectfont},
    }
\node[box](B1){Node $A$};
\node[box, below = of B1](S1){Node $B$};
\draw[arrow](B1) to [bend left,looseness=1.2] node[above] {Flow: $\alpha$} (S1);
\draw[arrow](S1) to [bend left,looseness=1.2] node[above] {Flow: $-\beta$} (B1);
    \end{tikzpicture}
\end{document}

Addendum: Text at arrows is aligned with it due to option slanted in \tikzset{...}. If you remove it, the text will appear horizontally aligned:

enter image description here

in this case the text at arrows is well aligned also if it is typed as label with help of library quotes:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows.meta, positioning, quotes}

\begin{document}
    \begin{tikzpicture}
\tikzset{
node distance = 9em and 4em,
%    sloped, % <-- removed for horizontal align of arrows labels
    box/.style = {%
    shape=rectangle,
    rounded corners,
    draw=blue!40,
    fill=blue!15,
    align=center,
    font=\fontsize{12}{12}\selectfont},
 arrow/.style = {%
    draw=blue!30,
    line width=2mm,% <-- select desired width
    -{Triangle[length=3mm]},
    shorten >=1mm, shorten <=1mm,
    font=\fontsize{8}{8}\selectfont},
    }
\node[box](B1){Node $A$};
\node[box, below = of B1](S1){Node $B$};
\draw[arrow](B1) to [bend left,looseness=1.2,"Flow: $\alpha$"] (S1);
\draw[arrow](S1) to [bend left,looseness=1.2,"Flow: $-\beta$"] (B1);
    \end{tikzpicture}
\end{document}
  • How to make the text horizontal ? – Paul Aug 1 '16 at 15:04
  • 1
    Simple. Just remove option slanted from \tikzset. See addendum to my answer. – Zarko Aug 1 '16 at 15:58
2

You can obtain curved arrow with to[out=alpha,in=beta]. where alpha is the angle at which the curve leaves the start coordinate, and beta is the angle at which the curve reaches the target coordinate.

Code

\documentclass{article}
\usepackage{color, colortbl} 
\usepackage{tikz}  
\usetikzlibrary{arrows,positioning,shapes,backgrounds,fit}  
\begin{document} 
\begin{figure}[ht]
 \centering
        \scalebox{.8}{
        \begin{tikzpicture}[
        node distance= 9em and 4em,
        sloped]
        \tikzset{
        box/.style = {
            fill=blue!15,
            shape=rectangle, 
            rounded corners,
                draw=blue!40, 
                align=center,
                %minimum size={10pt},
                text = black,
                font=\fontsize{12}{12}\selectfont},
        dummybox/.style = {
            shape=circle,  
                align=center, 
                minimum size={width("rrrrrrrrrrr")+2pt}},
        arrow/.style={
            color=black,
            draw=blue,
            -latex,
                font=\fontsize{8}{8}\selectfont},
        }

        \node[box](B1){Node $A$};
        \node[box, below = of B1](S1){Node $B$};
        \draw[arrow](B1.west) to [out=190,in=170] node[above]{Flow: $\alpha$ } (S1.west);

        \draw[arrow](S1.east) to [out=10,in=-10] node[above]{Flow: $-\beta$ } (B1.east);
\end{tikzpicture}}
\end{figure} 
\end{document}

Result

enter image description here

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.