如何将文本放置在相对于 TikZ 圆形路径的不同点?

如何将文本放置在相对于 TikZ 圆形路径的不同点?

我有以下代码,它使用 TikZ 生成一个小圆圈,其中包含圆形图像。如何将文本放置在相对于此圆圈的不同点?具体来说,

  • 如何将一些文字放置在圆圈的中心?
  • 如何在每个圆形图像下方添加标题?

\documentclass{article}
\usepackage{tikz}

\tikzset{%
    image 1/.initial=test.png,
    image 2/.initial=test.png,
    image 3/.initial=test.png,
    image 4/.initial=test.png,
    image 5/.initial=test.png,
    image 6/.initial=test.png,
    path image/.style={path picture={%
        \edef\imagename{\pgfkeysvalueof{/tikz/image #1}}%
        \node at (path picture bounding box.center){
            \includegraphics[height=1cm]{\imagename}
        };
    }}
}

\begin{document}

\begin{tikzpicture}
\foreach \i in {1,...,6}
    \draw [path image=\i] (\i * 60 + 30:2) circle [radius=0.5cm];
\end{tikzpicture}

\end{document}

\begin{document}

答案1

你必须找到你自己的图像...

\documentclass[tikz,border=5]{standalone}
\renewcommand\familydefault\sfdefault
\tikzset{%
  team/.cd,
    image/.store in=\imagefile, name/.store in=\imagenamed,
  member 1/.style={image=pugh1,    name=Pugh},
  member 2/.style={image=pugh2,    name=Pugh},
  member 3/.style={image=barney,   name=Barney McGrew},
  member 4/.style={image=cuthbert, name=Cuthbert},
  member 5/.style={image=dibble,   name=Dibble},
  member 6/.style={image=grub,     name=Grub},
  /tikz/pics/team member/.style={code={
\tikzset{team/.cd, member #1/.try}%
  \draw [path picture={%
    \node at (path picture bounding box.center) 
       {\includegraphics[width=1cm]{\imagefile}};}]
  circle [radius=0.5];
\node [below, font=\small, text width=4em, align=center] 
  at (0,-.5) {\imagenamed};
  }}
}
\begin{document}
\begin{tikzpicture}
\foreach \i in {1,...,6}
  \pic at (\i*60+30:2) {team member=\i};
\node [align=center] {Trumpton\\fire brigade};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容