将多个节点放置在一个圆圈周围

将多个节点放置在一个圆圈周围

我有下面的图片

在此处输入图片描述 使用代码

\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{tikz}
\usetikzlibrary {automata,positioning}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{backgrounds,fit,shapes}
\usetikzlibrary{decorations.pathreplacing,decorations.markings}
\usetikzlibrary {arrows.meta}

\begin{figure}
    \centering
    \begin{tikzpicture}
        [auto=right, thick,
shorten <>/.style = {shorten <=#1, shorten >=#1},
         N/.style = {draw,black, minimum size=8mm, align=center, font=\large},ultra thick,
        % Big circle
every edge/.append style = {draw, -Stealth}
        ]       

\foreach \x [count=\p] in {0,...,11} {
        \node[shape=circle,fill=black, scale=0.4] (\p) at (-\x*30:2) {};};
    \foreach \x [count=\p] in {0,...,5} {
        \draw (-\x*60:2.4) node {};
        \draw (-30-\x*60:2.4) ;}; 
    \draw (1) arc (0:360:2);
    
\node (Agent1) [N, right = 2cm of 1, fill= blue!10] {$u_1$};

\node (Agent1) [N, right = 2cm of 3, fill= blue!10] {$y_2$};

\node (Agent1) [N, right = 2cm of 11, fill= blue!10] {$y_1$};

\node (Agent1) [N, left = 2cm of 9, fill= blue!10] {$y_6$};

\node (Agent1) [N, left = 2cm of 7, fill= blue!10] {$u_6$};

\node (Agent1) [N, left = 2cm of 5, fill= blue!10] {$u_5$};

\node (Agent1) [N, below  = 1.5cm of 3, fill= blue!10] {$u_3$};


    
    \end{tikzpicture}
\end{figure}
\end{document}

这就是我想要创建的图像。

在此处输入图片描述

答案1

纯钛\foreachZ 解决方案,对所有节点使用几种样式、循环和极坐标:

\documentclass[tikz,border=1.618]{standalone}

\tikzset
{
  big node/.style={circle,draw,fill=gray!#1},
  small node/.style={rectangle,rounded corners,draw,fill=gray!#1},
}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,-latex]
\node[big node=80,fill=gray,minimum size=2.5cm] (s) at (0,0) {System};
\foreach\i in {1,...,6}
{
  \node[big node=60]   (a\i) at (120-60*\i:4.5) {Agent \i};
  \node[small node=30] (y\i) at (135-60*\i:2.5) {$y_\i$};
  \node[small node=20] (u\i) at (105-60*\i:2.5) {$u_\i$};
  \draw (s)   -- (y\i);
  \draw (y\i) -- (a\i);
  \draw (a\i) -- (u\i);
  \draw (u\i) -- (s);
}
\foreach\i in {1,...,6}
  \pgfmathtruncatemacro\j{mod(\i,6)+1}
  \draw[dashed] (a\j) -- (a\i);
\end{tikzpicture}
\end{document}

[1]:https://i.stack.imgur.com/1sVaj.png

相关内容