在 TikZ 中顺时针连接圆圈

在 TikZ 中顺时针连接圆圈

我需要它与我决定在 TikZ 中设置的任何内容一起工作\n(因为此时的图表尚未确定)。我不介意margin手动设置,但除了从节点 3 到 4 的弧之外,没有其他弧可以正确连接,而且我显然不擅长使用极坐标。

这是修改后的版本http://www.texample.net/tikz/examples/cycle/,但我希望它从左边开始,并且需要顺时针

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{center}
\begin{tikzpicture}[scale=0.7]

\def \n {5}
\def \radius {3cm}
\def \margin {8.2} % margin in angles, depends on the radius
% https://tex.stackexchange.com/questions/47172/what-does-the-colon-in-tikz-coordinates-mean
% http://www.texample.net/tikz/examples/cycle/

\foreach \s in {1,...,\n}
{
\node[draw, circle] at ({180 - 360/\n * (\s - 1)}:\radius) {$\s$};
\draw[->, >=latex] ({180 - 360/\n * (\s - 1)-\margin}:\radius) 
% https://tex.stackexchange.com/questions/175016/how-is-arc-defined-in-tikz
  arc ({2*\margin}:{-(180/\n)  + 2* \margin }:(\radius * 1.5);
}
\end{tikzpicture}
\end{center}


\end{document}

输出:

在此处输入图片描述

答案1

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\def \n {5}
\def \radius {3cm}
\def \margin {8} % margin in angles, depends on the radius
\foreach \s in {1,...,\n} {
  \node[draw, circle] at ({360/\n*(1-\s)}:-\radius) {\s};
  \draw[-latex] ({360/\n*(1-\s)-\margin}:-\radius) 
    arc ({360/\n*(1-\s)-\margin}:{-360/\n*\s+\margin}:-\radius);
}
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

正如指出的那样这里,这是一棵树,这样的树是懂得的clockwise

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[circ/.style={circle,draw},
level 1/.style={sibling angle=72,level distance=pi*1cm},
edge from parent/.style= {draw=none}]
\coordinate (Center)  [clockwise from=270]
    child foreach \X in {1,...,5} { node[circ] (\X) {\X}};
\foreach \X [remember=\X as \LastX (initially 5)] in  {1,...,5}
{\draw[-latex] (\LastX) to[bend left=28] (\X);}   
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

例如您链接的中,您可以更改绘制节点的程度以及箭头的方向\draw

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\def \n {5}
\def \radius {3cm}
\def \margin {8} % margin in angles, depends on the radius

\foreach \s in {1,...,\n}
{
  \node[draw, circle] at ({360/\n * (\n - \s - 1)}:\radius) {$\s$};
  \draw[<-, =>latex] ({360/\n * (\s - 1)+\margin}:\radius) 
    arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
}
\end{tikzpicture}

在此处输入图片描述

相关内容