15

This is the code, and I can create a diamond shape or a sketchy curved shape, but I would like the nodes to be aligned to a circle shape.

% Author: Paul Henckel, 2015
% Inspired by: Rasmus Pank Roulund via http://www.texample.net/tikz/examples/borrowers-and-lenders/

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning} 
\tikzset{
   %Define standard arrow tip
   >=stealth',
   %Define style for boxes
   punkt/.style={
         rectangle,
         rounded corners,
         draw=black, very thick,
         text width=8em,
         minimum height=2em,
         text centered},
   % Define arrow style
   pil/.style={
         ->,
         thick,
         shorten <=2pt,
         shorten >=2pt,}
}

\begin{document}
    \begin{tikzpicture}[node distance=2.5cm, auto]
     %nodes
     \node[punkt] (1food) {1. Food and Waste Identification};
     \node[punkt, above right of=1food] (8disintegration) {8. Disintegration};
        % edge[pil, bend left] (1food.north east);
     \node[punkt, above right of=8disintegration] (7distribution) {7. Distribution of waste};
        % edge[pil, bend left] (8disintegration.north east);
     \node[punkt, above left of=7distribution] (6preservation) {6. Preservation};
        % edge[pil, bend left] (7distribution.north);
     \node[punkt, above left of=6preservation] (5consumption) {5. Consumption};
        % edge[pil, bend left] (6preservation.north);
     \node[punkt, below left of=5consumption] (4preparation) {4. Preparation};
        % edge[pil, bend left] (5consumption.west);
     \node[punkt, below left of=4preparation] (3distribution) {3. Distribution of food};
        % edge[pil, bend left] (4preparation.west);
     \node[punkt, below right of=3distribution] (2production) {2. Production};
        % edge[pil, bend left] (3distribution.south);

    \draw[->] (1food) edge (2production); % Or use edge[bend left] to create curved lines
    \draw[->] (2production) edge (3distribution);
    \draw[->] (3distribution) edge (4preparation);
    \draw[->] (4preparation) edge (5consumption);
    \draw[->] (5consumption) edge (6preservation);
    \draw[->] (6preservation) edge (7distribution);
    \draw[->] (7distribution) edge (8disintegration);
    \draw[->] (8disintegration) edge (1food);

   \end{tikzpicture}
\end{document}
Paul H
  • 265

3 Answers3

18

An alternative solution is using a basic tree, placing the nodes in a clockwise fashion. I suggest switching to circle nodes: they have all the same shape, and the same size, therefore making the scheme a bit pleasing too, beyond being functional.

I have decreased the font size a bit, but it's still big enough to be read with ease. The arrows have been done using a \foreach to reduce the number of lines of code.

Finally, prefer using the standalone class over minimal. See this question for more details: Why should the minimal class be avoided?

Output

example image

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,trees} 

\tikzset{
    >=stealth',
    punkt/.style={
        circle,
        font=\scriptsize,
        draw, very thick,
        text width=5em,
        inner sep=3pt,
        text centered},
    pil/.style={
        ->,
        thick,
        shorten <=2pt,
        shorten >=2pt,},
    level 1/.style={sibling angle=45, level distance=3.5cm},
    edge from parent/.style= {draw=none},
}

\begin{document}
\begin{tikzpicture}

\coordinate (main) at (0,0) [clockwise from=270]
    child { node[punkt] (1) {1.\\Food and Waste Identification}}
    child { node[punkt] (2) {2.\\Production}}
    child { node[punkt] (3) {3.\\Distribution of food}}
    child { node[punkt] (4) {4.\\Preparation}}
    child { node[punkt] (5) {5.\\Consumption}}
    child { node[punkt] (6) {6.\\Preservation}}
    child { node[punkt] (7) {7.\\Distribution of waste}}
    child { node[punkt] (8) {8.\\Disintegration}}
;

\foreach \x [evaluate=\x as \y using int(\x+1)] in {1,...,8}{
    \ifnum\x<8
        \draw[->] (\x) edge[bend left=10] (\y);
    \else
        \draw[->] (8) edge[bend left=10] (1);
    \fi
}

\end{tikzpicture}
\end{document}
Alenanno
  • 37,338
13

This scheme can be easily drawn with smartdiagram package.

\documentclass[border=2mm]{standalone}
\usepackage{smartdiagram}
\usetikzlibrary{arrows.meta,bending}

\begin{document}
\smartdiagramset{module shape=circle, text width=1.5cm, font=\scriptsize, circular distance=3.7cm, arrow tip={}}
\smartdiagram[circular diagram:clockwise]{1.\\ Food and Waste Identification, 2.\\ Production, 3.\\ Distribution of food, 4.\\ Preparation, 5.\\ Consumption, 6.\\ Preservation, 7.\\ Distribution of waste, 8.\\ Dis\-integration}
\end{document}

enter image description here

Update: How to place node 1 to bottom.

Page 35 in smartdiagram documentation shows the code for circular clockwise diagram and to my knowledge is not possible to easily force an special position for a certain node. Code places node i in list at angular position 180+360*i/elements_in_list, therefore the first node is always the clockwise first after the western one.

I don't know how to change this behaviour unless the whole code is included and modified in preamble. But, knowing how the diagram is built, you can reorder the elements in such a way that Food and Waste Identification appears at bottom position in your diagram.

\documentclass[border=2mm]{standalone}
\usepackage{smartdiagram}
\usetikzlibrary{arrows.meta,bending}

\begin{document}
\smartdiagramset{module shape=circle, text width=1.5cm, font=\scriptsize, circular distance=3.7cm, arrow tip={}}
\smartdiagram[circular diagram:clockwise]{4.\\ Preparation, 5.\\ Consumption, 6.\\ Preservation, 7.\\ Distribution of waste, 8.\\ Dis\-integration, 1.\\ Food and Waste Identification, 2.\\ Production, 3.\\ Distribution of food}
\end{document}

enter image description here

Ignasi
  • 136,588
  • Interesting, I didnt know about the smartdiagram package at all, it looks good with colors and all, but how could you modify it so that the first point (1. Food and Waste Identification) is at the bottom? Thanks – Paul H Dec 21 '15 at 18:10
  • (I couldnt immediately find any tips from the manual http://texdoc.net/texmf-dist/doc/latex/smartdiagram/smartdiagram.pdf) – Paul H Dec 21 '15 at 18:18
  • 1
    @PaulH Please, look at updated answer. – Ignasi Dec 22 '15 at 08:26
8

The same with PSTricks and pst-node. Run with xelatex:

\documentclass[margin=10pt,pstricks]{standalone}
\usepackage{multido,pst-node,ragged2e}
\def\PB#1{\parbox[b][]{2cm}{\Centering\sffamily#1}}
\begin{document}
\begin{pspicture}(-6,-6)(6,6)
    \psset{radius=1.25}\degrees[8]% A circle with 8 units
    \pgfforeach \iA/\iB in {
      1/Food and Waste Identification,2/Production,3/Distribution of food,
      4/Preparation,5/Consumption,6/Preservation,7/Distribution of waste,
      8/Disintegration}{\Cnodeput[fillcolor=blue!20,fillstyle=solid]{0}(5;\iA){\iA}{\PB{\iA.\\\iB}}}
    \nccurve[arrowscale=1.5,ncurv=.5,angleA=2,angleB=7]{<-}{8}{1}
    \multido{\iA=1+1,\iB=2+1,\iC=3+1,\iD=0+1}{7}{%
        \nccurve[arrowscale=1.5,ncurv=.5,angleA=\iC,angleB=\iD]{<-}{\iA}{\iB}}
\end{pspicture}
\end{document}

enter image description here