2

I want to combine a simple mind map with a tree.

First I tried to get something like the following mindmap from pgf manual p. 79:

mindmap

Thanks to @cfr, I could get the mindmap to work. Using the source code from the TikZ & PGF documentation. Problem is I couldn't get a version such plain, its always with colors like on p. 82. :(

Now the only problem is that everything underneath should be like a tree, shown in the next figure, which was taken from texample and is working on his own. I just down know how to combine both concepts.

enter image description here

Can you help me?


Minimal example:

\documentclass{article}
\usepackage{tikz}

\begin{document}

    \begin{figure}
        \centering
        \usetikzlibrary{trees}  
        \begin{tikzpicture}[scale=0.9,text width=2.7cm, align=flush center,
        grow cyclic,
        level 1/.style={level distance=2.5cm,sibling angle=90},
        level 2/.style={text width=2cm, font=\footnotesize, level distance=3cm,sibling angle=30}]
        \node[font=\bfseries] {Computational Complexity} % root
        child { node {Computational Problems}
            child { node {Problem Measures} }           child { node {Problem Aspects} }
            child { node {Problem Domains} }            child { node {Key Problems} }
        }
        child { node {Computational Models}
            child { node {Turing Machines} }            child { node {Random-Access Machines} }
            child { node {Circuits} }                   child { node {Binary Decision Diagrams} }
            child { node {Oracle Machines} }            child { node {Programming in Logic} }
        }
        child { node {Measuring Complexity}
            child { node {Complexity Measures} }        child { node {Classifying Complexity} }
            child { node {Comparing Complexity} }       child { node {Describing Complexity} }
        }
        child { node {Solving Problems}
            child { node {Exact Algorithms} }           child { node {Randomization} }
            child { node {Fixed-Parameter Algorithms} } child { node {Parallel Computation} }
            child { node {Partial Solutions} }          child { node {Approximation} }
        };
        \end{tikzpicture}
        \caption{Mindmap}
        \label{test}
    \end{figure}

    The happy tree works fine but has wrong root ....

    \usetikzlibrary{arrows,shapes,positioning,shadows,trees}
    \tikzset{
        basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
        root/.style   = {basic, rounded corners=2pt, thin, align=center,
            fill=green!30},
        level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60,
            text width=8em},
        level 3/.style = {basic, thin, align=left, fill=pink!60, text width=6.5em}
    }
    \begin{tikzpicture}[
    level 1/.style={sibling distance=40mm},
    edge from parent/.style={->,draw},
    >=latex]

    % root of the the initial tree, level 1
    \node[root] {Drawing diagrams}
    % The first level, as children of the initial tree
    child {node[level 2] (c1) {Defining node and arrow styles}}
    child {node[level 2] (c2) {Positioning the nodes}}
    child {node[level 2] (c3) {Drawing arrows between nodes}};

    % The second level, relatively positioned nodes
    \begin{scope}[every node/.style={level 3}]
    \node [below of = c1, xshift=15pt] (c11) {Setting shape};
    \node [below of = c11] (c12) {Choosing color};
    \node [below of = c12] (c13) {Adding shading};

    \node [below of = c2, xshift=15pt] (c21) {Using a Matrix};
    \node [below of = c21] (c22) {Relatively};
    \node [below of = c22] (c23) {Absolutely};
    \node [below of = c23] (c24) {Using overlays};

    \node [below of = c3, xshift=15pt] (c31) {Default arrows};
    \node [below of = c31] (c32) {Arrow library};
    \node [below of = c32] (c33) {Resizing tips};
    \node [below of = c33] (c34) {Shortening};
    \node [below of = c34] (c35) {Bending};
    \end{scope}

    % lines from each level 1 node to every one of its "children"
    \foreach \value in {1,2,3}
    \draw[->] (c1.195) |- (c1\value.west);

    \foreach \value in {1,...,4}
    \draw[->] (c2.195) |- (c2\value.west);

    \foreach \value in {1,...,5}
    \draw[->] (c3.195) |- (c3\value.west);
    \end{tikzpicture}

\end{document}
  • I want the style as plain and clean as possible. So no colors are required. Just 3 levels! The first 2 as mindmap the last level as tree. – lony Oct 15 '14 at 20:11
  • It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem and shows haw far you got. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill Oct 15 '14 at 20:29
  • Thanks @PeterGrill I added one. Didn't thought about but its a good idea! – lony Oct 15 '14 at 21:01
  • Why exactly are you specifying colours if you don't want them? Surely you could modify the code yourself to that extent, at least? Also, since you presumably cut and pasted that from somewhere, you should attribute it to your source. – cfr Oct 16 '14 at 3:02
  • 1
    @cfr The question is whether you can get the last level of mindmap involving trees or not. – percusse Oct 16 '14 at 5:27

Browse other questions tagged or ask your own question.