1

I want to add to my tikz diagram an additional feedback edge (positioning it in the right part of the figure) that goes from the terminal node (mecon2) to the initial one (mecon). However, since i recently started to learn about tikz, i dont know how to make that feedback edge between the two nodes. I also want to know how to add a comment right to that feedback edge.

I know this is something pretty basic but is my first attempt to create a flow chart in tikz. I have seen another similar posts (suggested using \path or \draw command in different variations) but it didnt work in my code. Below is the image and the code used to generate it.

Any idea about how to do it?

Thanks!

Flow_Chart

 \documentclass{article}
 \usepackage[utf8]{inputenc}
 \usepackage{tikz}
 \usetikzlibrary{shapes}
 \usetikzlibrary{positioning}
 \usepackage{amsmath}
 \usepackage{xspace}
 \newcommand{\A}{\ensuremath{\mathcal{A}}\xspace}
 \newcommand{\B}{\ensuremath{\mathcal{B}}\xspace}
 \newcommand\pa[1]{\ensuremath{\left(#1\right)}}
 \usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,fit,positioning,shapes.symbols,chains, 
 shapes.geometric}
 \usetikzlibrary{positioning}

\title{Graficos con TIKZ}

\author{me}
\date{December 2020}

\begin{document}


 \begin{figure}[h]

 \centering
 \begin{tikzpicture}
 [node distance = 1cm, auto,font=\footnotesize,
 % STYLES
 every node/.style={node distance=3cm},
 % The comment style is used to describe the characteristics of each force
 comment/.style={rectangle, inner sep= 5pt, text width=4cm, node distance=0.25cm,  
 font=\scriptsize\sffamily},
 % The force style is used to draw the forces' name
 force/.style={rectangle, draw, fill=black!10, inner sep=5pt, text width=4cm, text badly centered, 
 minimum height=1.2cm, font=\bfseries\footnotesize\sffamily}] 

  % Draw forces
 \node [force] (mecon) {Modelos Economicos};
 \node [force, below of=mecon] (mbiof) {Modelos Biofisicos};
 \node [force, below of=mbiof] (mecon2) {Modelos Economicos};


 %%%%%%%%%%%%%%%
 % Change data from here


  \node [comment, left=0.25 of mecon] (comment-mecon) {- Uso y decisiones de manejo de la tierra. \\
  - Señales de mercado  \\
  - Politicas Publicas y regulacion
  };

  % MODELOS BIOFISICOS 
  \node [comment, left=0.25cm of mbiof] {-Procesos naturales y físicos\\
   - Clima \\
   - Cantidad de agua e hidrología \\
   - Calidad del suelo \\
   - Calidad del agua \\
   - Cosechas \\
   - Producción de biomasa \\
   - Biodiversidad y habitats};

   % MODELOS BIOFISICOS 2
   \node [comment, left=0.25 of mecon2] {- Valor de los bienes producidos (alimentos y 
   combustibles)\\ 
   - Valuación no comercial de bienes y servicios ecosistémicos};


   %%%%%%%%%%%%%%%%

   % Draw the links between forces
   \path[->,thick] 
   (mecon) edge (mbiof)
   (mbiof) edge (mecon2)



   \end{tikzpicture} 
   \caption{ Esquema de los Componentes de Un Modelo de Evaluaci ́on Integrado Ambiente-Econoḿıa}
   \label{fig:flowdiagram}
   \end{figure}

   \end{document}
1
  • please have a look at the answer below -- you have also forgotten a semicolon in the last line of the code -- I have added it-- notice that cardinal points on the compass are available with all nodes for attaching edges etc -- eg mecon.east
    – js bibra
    Dec 28, 2020 at 3:54

2 Answers 2

1

add the following at the end of your code

    \draw[->, thick]
    (mecon2.east)to++(2cm,0)|-(mecon.east);
    

enter image description here

complete MWE

 \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{positioning}
\usepackage{amsmath}
\usepackage{xspace}
\newcommand{\A}{\ensuremath{\mathcal{A}}\xspace}
\newcommand{\B}{\ensuremath{\mathcal{B}}\xspace}
\newcommand\pa[1]{\ensuremath{\left(#1\right)}}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,fit,positioning,shapes.symbols,chains, 
    shapes.geometric}
\usetikzlibrary{positioning}

\title{Graficos con TIKZ}

\author{me}
\date{December 2020}

\begin{document}
    
    
    \begin{figure}[h]
        
        \centering
        \begin{tikzpicture}
            [node distance = 1cm, auto,font=\footnotesize,
            % STYLES
            every node/.style={node distance=3cm},
            % The comment style is used to describe the characteristics of each force
            comment/.style={rectangle, inner sep= 5pt, text width=4cm, node distance=0.25cm,  
                font=\scriptsize\sffamily},
            % The force style is used to draw the forces' name
            force/.style={rectangle, draw, fill=black!10, inner sep=5pt, text width=4cm, text badly centered, 
                minimum height=1.2cm, font=\bfseries\footnotesize\sffamily}] 
            
            % Draw forces
            \node [force] (mecon) {Modelos Economicos};
            \node [force, below of=mecon] (mbiof) {Modelos Biofisicos};
            \node [force, below of=mbiof] (mecon2) {Modelos Economicos};
            
            
            %%%%%%%%%%%%%%%
            % Change data from here
            
            
            \node [comment, left=0.25 of mecon] (comment-mecon) {- Uso y decisiones de manejo de la tierra. \\
                - Señales de mercado  \\
                - Politicas Publicas y regulacion
            };
            
            % MODELOS BIOFISICOS 
            \node [comment, left=0.25cm of mbiof] {-Procesos naturales y físicos\\
                - Clima \\
                - Cantidad de agua e hidrología \\
                - Calidad del suelo \\
                - Calidad del agua \\
                - Cosechas \\
                - Producción de biomasa \\
                - Biodiversidad y habitats};
            
            % MODELOS BIOFISICOS 2
            \node [comment, left=0.25 of mecon2] {- Valor de los bienes producidos (alimentos y 
                combustibles)\\ 
                - Valuación no comercial de bienes y servicios ecosistémicos};
            
            
            %%%%%%%%%%%%%%%%
            
            % Draw the links between forces
            \path[->,thick] 
            (mecon) edge (mbiof)
            (mbiof) edge (mecon2);
            
            \draw[->, thick]
            (mecon2.east)to++(2cm,0)|-(mecon.east);
            
            
        \end{tikzpicture} 
%       \caption{ Esquema de los Componentes de Un Modelo de Evaluaci ́on Integrado Ambiente-Econoḿıa}
        \label{fig:flowdiagram}
    \end{figure}
    
\end{document}
1
  • Thanks so much! Any idea about how to put a comment at the right side of the edge line? Tried using (mecon2.east)to++(2cm,0) node[align=righy] {mycomment} |-(mecon.east); but failed.
    – Augusto
    Dec 28, 2020 at 4:20
0

An alternative solution, where are employed enumitem package for list left of main nodes, and TikZ library chains for positioning of main nodes. Lists are written as labels to main nodes:

\documentclass{article}
 \usepackage{tikz}
 \usetikzlibrary{arrows.meta, 
                 chains, % <---
                 positioning}
 \usepackage{enumitem}   % <---

 \begin{document}
    \begin{figure}[ht]  % <--
    \setlist[itemize]{nosep,leftmargin=*,labelsep=0.5ex} % <---
\centering
    \begin{tikzpicture}[
node distance = 17mm, 
  start chain = going below,
               arr/.style = {-{Straight Barb[length=4pt]}, semithick},
every label/.append style = {font=\footnotesize\sffamily, text width=42mm,
                             label distance=3mm},
                 N/.style = {draw, fill=gray!30, font=\sffamily\bfseries,
                             minimum height=12mm, text width=44mm, align=center,
                             on chain, join=by ->}
                        ]
\node (a)   [N, label=left:\begin{itemize}
                    \item   Uso y decisiones de manejo de la tierra. 
                    \item   Señales de mercado
                    \item   Politicas Publicas y regulacion
                        \end{itemize} ] {Modelos Economicos};
\node (b)   [N, label=left:\begin{itemize}
                    \item   Clima 
                    \item   Cantidad de agua e hidrología 
                    \item   Calidad del suelo 
                    \item   Calidad del agua 
                    \item   Cosechas 
                    \item   Producción de biomasa 
                    \item   Biodiversidad y habitats 
                        \end{itemize} ] {Modelos Biofisicos};
\node (c)   [N, label=left:{\begin{itemize}
                    \item   Valor de los bienes producidos (alimentos ycombustibles)
                    \item   Valuación no comercial de bienes y servicios ecosistémicos
                        \end{itemize} }] {Modelos Economicos};
\draw   (c.east) -- ++ (1,0) |- (a) node[pos=0.25, right] {my comment};
   \end{tikzpicture}
\caption{Esquema de los Componentes de Un Modelo de Evaluaci ́on Integrado Ambiente-Econoḿıa}
\label{fig:flowdiagram}
   \end{figure}
\end{document}

enter image description here

(MWE is compiled by XeLaTeX engine)

You must log in to answer this question.

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