3

I am trying very hard since a while to draw a mindmap where shading of connection bars is avoided and where the connection bar's color is specified by me.

For instance, I would like to draw two green concepts connected by a red connection bar.

This has many applications, typically when the bar's color represents an option (e.g. a red bar meaning true and a green bar meaning false).

Evidently, there is alway the dirty option consisting in manually naming nodes and connecting them manually but this is not viable for large mindmaps. I would just want to specify each connection bar's color and avoid the shading.

Does anybody know how to do that?

2
  • Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Commented Aug 19, 2013 at 21:23
  • Well, I am precisely trying to produce an example and not managing to... I am not facing a mistake but something that I do not manage to produce.
    – David N
    Commented Aug 19, 2013 at 22:13

1 Answer 1

3

Not as straightforward as I'd originally thought (unless I've overlooked something), but below I've defined a connection bar color key to do the job (which I suppose should strictly speaking be called circle connection bar color).

Note that connection bars are drawn on very slightly on top of nodes to avoid gaps caused by TeX math inaccuracies, so the outer sep has to set for the concept nodes to take this into account (e.g., 0.5pt seems to get it roughly on the edges). I've set it so there is a gap as I actually think it looks quite nice in this case.

Also the connection bar color is inherited by any child nodes.

\documentclass[border=1pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap}
\begin{document}

\tikzset{%
    connection bar color/.style={
        every circle connection bar/.append style={
            append after command={[fill=#1]}
        }
    },
    connection false/.style={
        connection bar color=red!30!purple,
    },
    connection true/.style={
        connection bar color=green!40!orange
    },  
}

\tikz[mindmap, concept color=yellow!50!orange, 
    every concept/.style={
        text=black,
        font=\sf,
        outer sep=1.5pt% Have to determine by trial and error
    },
    level 1 concept/.append style={
        level distance=5cm
    },
    level 2 concept/.append style={
        level distance=4cm
    }
]
\node [concept] {Like cheese?}
    child [grow=30, connection true] { 
        node [concept] {Whiskers?}
            child [grow=30] {% NB connection true inherited
                node [concept] {Mouse}
            }
            child [grow=-30, connection false] {
                node  [concept] {Human}
            }
    }
    child [grow=-30, connection false] {
        node  [concept] {Cat}
    };

\end{document}

enter image description here

You must log in to answer this question.

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