向 tikz 思维导图插入特殊边框

向 tikz 思维导图插入特殊边框

你好,我想标记 tikz-mindmap 的某些节点,图中仅举例说明。

提前致谢在此处输入图片描述

最小工作代码在这里


\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{tikzpagenodes}
\usepackage{graphicx}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.text}
\tikzset{>=latex}
\usetikzlibrary{mindmap,trees,shadows}
\usetikzlibrary{decorations.text}
\usetikzlibrary{shapes.multipart}
\usepgfplotslibrary{patchplots}
\pgfplotsset{compat=1.8}
\begin{document}
\definecolor{CIR}{RGB}{255,0,35}
\definecolor{PN}{RGB}{97,189,64}
\definecolor{CFO}{RGB}{92,219,101}
\definecolor{DCO}{RGB}{255,131,211}
\definecolor{AN}{RGB}{72,163,235}
\definecolor{IQ}{RGB}{234,193,137} %253,224,158
\definecolor{IQTx}{RGB}{255,173,45} %241,88,21
\definecolor{IQRx}{RGB}{216,182,145}
\definecolor{IQFs}{RGB}{252,221,153}%206,165,75
\definecolor{IQFi}{RGB}{252,218,23}
\definecolor{baige}{RGB}{226,230,156}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}

\begin{figure}[H]
\begin{center}
\begin{tikzpicture}[very thick, scale=0.8,
 every node/.style={scale=0.8},
 decoration={start radius=1cm, end radius=.15cm,amplitude=2mm,angle=30},
 outer sep=1pt
  ]
  \path[mindmap,concept color=red,text=white]
    node[concept] {\bf Root}
    [clockwise from=0]
    child[concept color=IQ] {
      node[concept] {\textcolor{white}{\bf A}}
      [clockwise from=120]
      child [concept color=IQTx,text=white] { node[concept] {{\bf A1}} }
      child [concept color=IQRx,text=white] { node[concept] {{\bf A2} }  }
      child [concept color=IQFs,text=white] { node[concept] {{\bf A3} }  }
      child [concept color=IQFi,text=white]{ node[concept] {\bf A4} }
      }  
        child[concept color=DCO, grow=75, level distance=4.5cm,text=white ] {node[concept] {\bf B} }
child[concept color=PN, grow=150,level distance=4.5cm,text=white] { node[concept] {\bf C} } 
child[concept color=CFO, grow=215, level distance=4.5cm,text=white] { node[concept] {\bf D} }
child[concept color=AN, grow=290, level distance=4.5cm,text=white] { node[concept] {\bf E} };
\end{tikzpicture}
\caption{Mindmap Problem}
\label{fig:mindmap}
\end{center}
\end{figure}
\end{document}

任何帮助将非常感激。

穆罕默德阿里

答案1

下一个代码展示了一种可能性。它包括在background图层上绘制更大的思维导图。在这种情况下,这很容易,因为您已经使用了every node/.style={scale=0.8},因此将其更改为scale=0.85所有放大的元素。Concepts带边框的部分用黑色绘制(或您喜欢的边框颜色),其他部分用白色绘制(或您用于背景的任何颜色)。

我承认这不是最好的解决方案,但它确实有效。

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap,backgrounds}
\begin{document}
\definecolor{PN}{RGB}{97,189,64}
\definecolor{CFO}{RGB}{92,219,101}
\definecolor{DCO}{RGB}{255,131,211}
\definecolor{AN}{RGB}{72,163,235}
\definecolor{IQ}{RGB}{234,193,137} 
\definecolor{IQTx}{RGB}{255,173,45} 
\definecolor{IQRx}{RGB}{216,182,145}
\definecolor{IQFs}{RGB}{252,221,153}
\definecolor{IQFi}{RGB}{252,218,23}

\begin{tikzpicture}[very thick, scale=0.8,
 every node/.style={scale=0.8},
 outer sep=1pt
  ]
  \path[mindmap,concept color=red,text=white]
    node[concept] {\bf Root}
    [clockwise from=0]
    child[concept color=IQ] {
      node[concept] {\textcolor{white}{\bf A}}
      [clockwise from=120]
      child [concept color=IQTx,text=white] {node[concept] {{\bf A1}}}
      child [concept color=IQRx,text=white] {node[concept] {{\bf A2}}}
      child [concept color=IQFs,text=white] {node[concept] {{\bf A3}}}
      child [concept color=IQFi,text=white] {node[concept] {\bf A4}}
      }  
    child [concept color=DCO, grow=75, level distance=4.5cm, text=white] 
          {node[concept] {\bf B}}
    child [concept color=PN, grow=150, level distance=4.5cm, text=white] 
          {node[concept] {\bf C}} 
    child [concept color=CFO, grow=215, level distance=4.5cm, text=white] 
          {node[concept] {\bf D}}
    child [concept color=AN, grow=290, level distance=4.5cm, text=white] 
          {node[concept] {\bf E}};

\begin{scope}[on background layer, every node/.style={scale=.85}]
  \path[mindmap,concept color=black,text=black]
    node[concept] {\bf Root}
    [clockwise from=0]
    child[concept color=black] {
      node[concept] {\textcolor{white}{\bf A}}
      [clockwise from=120]
      child [concept color=black,text=black] {node[concept] {{\bf A1}}}
      child [concept color=black,text=black] {node[concept] {{\bf A2}}}
      child [concept color=white,text=white] {node[concept] {{\bf A3}}}
      child [concept color=black,text=black] {node[concept] {\bf A4}}
      }  
      child [concept color=white, grow=75, level distance=4.5cm, text=white] 
            {node[concept] {\bf B}}
      child [concept color=white, grow=150, level distance=4.5cm, text=white] 
            {node[concept] {\bf C}} 
      child [concept color=black, grow=215, level distance=4.5cm, text=black] 
            {node[concept] {\bf D}}
      child [concept color=white, grow=290, level distance=4.5cm, text=white] 
            {node[concept] {\bf E}};
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

更新:

一个更简单的解决方案是将general shadow(或preaction) 添加到突出显示的概念中。我不知道如何将其应用于概念连接。

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap,shadows}
\begin{document}
\definecolor{PN}{RGB}{97,189,64}
\definecolor{CFO}{RGB}{92,219,101}
\definecolor{DCO}{RGB}{255,131,211}
\definecolor{AN}{RGB}{72,163,235}
\definecolor{IQ}{RGB}{234,193,137} 
\definecolor{IQTx}{RGB}{255,173,45} 
\definecolor{IQRx}{RGB}{216,182,145}
\definecolor{IQFs}{RGB}{252,221,153}
\definecolor{IQFi}{RGB}{252,218,23}

\begin{tikzpicture}[very thick, scale=0.8,
 every concept/.style={scale=.8, font=\bfseries, text=white},
 marca/.append style={general shadow={fill=black,shadow scale=1.07}},
 outer sep=1pt,
  ]
  \path[mindmap,concept color=red]
    node[concept, marca] {\bf Root}
    [clockwise from=0]
    child[concept color=IQ] {
      node[concept, marca] {\bf A}
      [clockwise from=120]
        child [concept color=IQTx] {node[concept, marca] {A1}}
        child [concept color=IQRx] {node[concept, marca] {A2}}
        child [concept color=IQFs] {node[concept] {A3}}
        child [concept color=IQFi] {node[concept, marca] {A4}}}  
    child [concept color=DCO, grow=75, level distance=4.5cm] {node[concept] {B}}
    child [concept color=PN, grow=150, level distance=4.5cm] {node[concept] {C}} 
    child[concept color=CFO, grow=215, level distance=4.5cm] {node[concept, marca] {D}}
    child[concept color=AN, grow=290, level distance=4.5cm] {node[concept] {E}};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容