我想在选定图像上创建思维导图。到目前为止,我尝试了以下代码,但它只创建了背景图像,并没有绘制思维导图。有什么想法吗?
\begin{document}
\begin{tikzpicture}[ every annotation/.style = {draw,
fill = white, font = \Large}]
\path[mindmap,concept color=black!40,text=white,
every node/.style={concept,circular drop shadow},
root/.style = {concept color=black!40,
font=\large\bfseries,text width=10em},
level 1 concept/.append style={font=\Large\bfseries,
sibling angle=45,text width=7.7em,
level distance=40em,inner sep=0pt},
level 2 concept/.append style={font=\bfseries,level distance=15em},
]
node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[width=\textwidth]{/Users/Dms/Pictures/vein.png}};
node[root, concept, ball color = gray, scale = 2] {\huge ROOT_NODE}} [clockwise from=0]
child[concept color=blue!60] {
node [concept, ball color=blue!60, scale = 1.5]{NODE_1} [clockwise from=90]
child { node [concept, ball color=blue!60, scale = 1.5] (CHILD1)}
child { node [concept, ball color=blue!60, scale = 1.5] (CHILD2)}
}
\end{tikzpicture}
\end{document}
答案1
您的代码中存在多个错误。
- 带有背景图像的节点后的分号结束命令
\path
,因此不执行任何思维导图命令;删除分号。 - 下划线前需要一个反斜杠:
ROOT\_NODE
,NODE\_1
。 - 最后一个节点的标签必须用大括号而不是圆括号括起来:
{CHILD1}
,{CHILD2}
。 }
后面有多余的ROOT\_NODE
,删除它。- 命令末尾缺少分号
\path
。
如果我用 替换您的图像example-image
,您的代码可以编译,但尺寸和大小不合适。背景图像在根节点后面几乎不可见,并且思维导图超出了合理的页面,这对于像 这样的距离来说并不奇怪40em
。(请注意,我使用standalone
使页面尽可能大的类;尝试article
,页面上只会剩下根节点。)
我建议重新开始,一次只添加一个元素,并进行调整直到适合为止,然后再添加更多元素。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap,shadows}
\begin{document}
\begin{tikzpicture}[ every annotation/.style = {draw,
fill = white, font = \Large}]
\path[mindmap,concept color=black!40,text=white,
every node/.style={concept,circular drop shadow},
root/.style = {concept color=black!40,
font=\large\bfseries,text width=10em},
level 1 concept/.append style={font=\Large\bfseries,
sibling angle=45,text width=7.7em,
level distance=40em,inner sep=0pt},
level 2 concept/.append style={font=\bfseries,level distance=15em},
]
node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[width=\textwidth]{example-image}}
node[root, concept, ball color = gray, scale = 2] {\huge ROOT\_NODE} [clockwise from=0]
child[concept color=blue!60] {
node [concept, ball color=blue!60, scale = 1.5]{NODE\_1} [clockwise from=90]
child { node [concept, ball color=blue!60, scale = 1.5] {CHILD1}}
child { node [concept, ball color=blue!60, scale = 1.5] {CHILD2}}
};
\end{tikzpicture}
\end{document}