8

Is there an automated way or a "template" to create Ishikawa (also called "fishone") diagrams with LaTeX?

They are used e. g. to show the factors influencing a process and have a hiearchical structure:

  • the horizontal main line is the process itself
  • the big branches show the main factors
  • and they can be detailed further to show the factors which influence or "compose" the main factors

For the usage:

  • it would be great if the layout (distributing the branches equally) could be done more or less automatically

Example from wikipedia (http://en.wikipedia.org/wiki/Ishikawa_diagram):

example

(link to google search result for more "inspiring" examples, to see how such diagrams can look like and how they are used)

  • 3
    Like all diagrams, it could be created using TikZ package. I am not aware of any packages that enable automated creation, however. – ipavlic Apr 19 '11 at 8:25
  • is there some general concept in TikZ which allows drawing hierarchical "tree" structures like that and then define the corresponding formatting? Is the automatic placing of the elements (for better distribution in the available space) possible with TikZ? – MostlyHarmless Apr 19 '11 at 8:54
  • 1
    Yes for a hierarchical tree structure, no for automatic placement. – Matthew Leingang Apr 19 '11 at 9:21
  • @Matthew Leingang: thanks for clarifying. So there is no way that TikZ could arrange the arrows automatically? Is there another tool which could do that? – MostlyHarmless Apr 19 '11 at 10:18
5

TikZ trees would probably be the way to go. However, things get pretty hairy fairly early on (example in Plain w/ XeTeX):

\input tikz
\font\figfont="Myriad Pro" at 8pt
\font\tinyfigfont="Myriad Pro" at 6pt
\usetikzlibrary{trees,shapes.geometric}
\tikzpicture[>=latex,font=\figfont,lbl/.style={draw=black,very thin,fill=#1,ellipse}]
  \coordinate
    child [grow=right] {
      child {
        child [grow=125] {
          child [grow=left] {node {\tinyfigfont Cost of Transport} edge from parent[<-,thin]}
          child {
            child [grow=left] {node {\tinyfigfont Access to premises} edge from parent[<-,thin]}
            child {node [lbl=yellow!20] {Transport}}
            child [missing]
          }
          child [missing] edge from parent[<-,thick]
        }
        child [xshift=1cm] {
          child [grow=125] {
            child [grow=left] {node {\tinyfigfont Security} edge from parent[<-,thin]}
            child {node [lbl=green!20!yellow] {Premises}}
            child [missing] edge from parent[<-,thick]
          }
          child
          child [grow=-125]
        }
        child [grow=-125] {
          child [grow=left] {node {\tinyfigfont Consultation} edge from parent[<-,thin]}
          child {node [lbl=purple!20] {Clients}}
          child [missing] edge from parent[<-,thick]
        }
      }
    };
\endtikzpicture
\bye

enter image description here

This could be improved upon a lot, but hopefully I could give you some idea.

  • thank you, that looks promising. As you say "example for pain with XeTeX": would it make a difference to use that in pdflatex or what does that mean? – MostlyHarmless Apr 20 '11 at 5:16
  • and could you explain what becomes "fairly hairy"? For a TikZ newbie like me the example looks ok and the code also? – MostlyHarmless Apr 20 '11 at 5:19
  • 2
    @Martin: I used XeTeX merely for the font here. With pdflatex the font-commands would look different I think. And the first \input tikz would be something different with pdflatex. Let me answer your other question with a question: Can you tell where would you put the next node? How about another one inside the "Transport"-branch? Yeah. Hairy. – morbusg Apr 20 '11 at 6:22
4

Here's an alternative that uses pdflatex. I've made it based on the example from https://texwelt.de/fragen/13171/ishikawa-tikz-diagram. This is basically a non-iterative form of that example with text labels included.

Latex code:

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning,matrix}
\tikzset{
  ishikawa/.style={align=center, inner sep=0pt},
  matter/.style  ={rectangle, minimum size=6mm, very thick, draw=red!70!black!40,
    top color=white, bottom color=red!50!black!20, font=\itshape},
  level_1/.style ={ellipse, node distance=60pt, minimum size=6mm, very thick,
    draw=red!50!black!50, top color=white, bottom color=red!50!black!20, font=\itshape},
  level_2/.style={rectangle, minimum size=6mm, font=\itshape, font=\scriptsize}}
\tikzset{
  rows/.style 2 args={@/.style={row ##1/.style={#2}},@/.list={#1}},
  cols/.style 2 args={@/.style={column ##1/.style={#2}},@/.list={#1}},
}
\begin{document}
\begin{tikzpicture}
\matrix[
  matrix of nodes,
  row sep=3cm,
  column sep=1cm,
  rows={1,3}{nodes=level_1},
  rows={2}{nodes=matter,anchor=center}
] (m) {
The Cause 1 & The Cause 2 & The Cause 3 & \\
         &         &             & The Effect \\
The Cause 4  & The Cause 5  & The Cause 6     & \\
};
\path[very thick,
  toarr/.style={->, shorten <=+0pt, shorten >=+.1cm},
  fromarr/.style={<-, shorten >=+0pt, shorten <=+.1cm}]

  % Mid left to right arrow
  [toarr]
  (m-1-1|-m-2-4) edge (m-2-4)

  % The Cause 1 arrows
  (m-1-1) edge[xslant=-.5]
    coordinate[pos=.3]   (@-1-1-1)
    coordinate[near end] (@-1-1-2) (m-1-1|-m-2-4)
  [fromarr]
  (@-1-1-1) edge node[above, level_2]{Subcause 1} ++ (left:2cm)
  (@-1-1-2) edge node[above, level_2]{Subcause 2} ++ (left:2cm)

  % The Cause 2 arrows
  (m-1-2) edge[xslant=-.5]
    coordinate[pos=.3]   (@-1-2-1)
    coordinate[near end] (@-1-2-2) (m-1-2|-m-2-4)
  [fromarr]
  (@-1-2-1) edge node[above, level_2]{Subcause 1} ++ (left:2cm)
  (@-1-2-2) edge node[above, level_2]{Subcause 2} ++ (left:2cm)

  % The Cause 3 arrows
  (m-1-3) edge[xslant=-.5]
    coordinate[pos=.3]   (@-1-3-1)
    coordinate[near end] (@-1-3-2) (m-1-3|-m-2-4)
  [fromarr]
  (@-1-3-1) edge node[above, level_2]{Subcause 1} ++ (left:2cm)
  (@-1-3-2) edge node[above, level_2]{Subcause 2} ++ (left:2cm)

  % The Cause 4 arrows
  (m-3-1) edge[xslant=.5]
    coordinate[pos=.3]   (@-3-1-1)
    coordinate[near end] (@-3-1-2) (m-3-1|-m-2-4)
  [fromarr]
  (@-3-1-1) edge node[above, level_2]{Subcause 1} ++ (left:2cm)
  (@-3-1-2) edge node[above, level_2]{Subcause 2} ++ (left:2cm)

  % The Cause 5 arrows
  (m-3-2) edge[xslant=.5]
    coordinate[pos=.3]   (@-3-2-1)
    coordinate[near end] (@-3-2-2) (m-3-2|-m-2-4)
  [fromarr]
  (@-3-2-1) edge node[above, level_2]{Subcause 1} ++ (left:2cm)
  (@-3-2-2) edge node[above, level_2]{Subcause 2} ++ (left:2cm)

  % The Cause 6 arrows
  (m-3-3) edge[xslant=.5]
    coordinate[pos=.3]   (@-3-3-1)
    coordinate[near end] (@-3-3-2) (m-3-3|-m-2-4)
  [fromarr]
  (@-3-3-1) edge node[above, level_2]{Subcause 1} ++ (left:2cm)
  (@-3-3-2) edge node[above, level_2]{Subcause 2} ++ (left:2cm);
\end{tikzpicture}
\end{document}

Result:

To produce the pdf do:

pdflatex fishbone.tex

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.