![tikz 节点之间的角度路径](https://linux22.com/image/332331/tikz%20%E8%8A%82%E7%82%B9%E4%B9%8B%E9%97%B4%E7%9A%84%E8%A7%92%E5%BA%A6%E8%B7%AF%E5%BE%84.png)
考虑以下 MWE:
\documentclass{beamer}
\usepackage{fontspec}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{decorations.text,calc,shapes,matrix,backgrounds,arrows,shadows,
positioning,fit,automata,decorations.pathreplacing,arrows.meta,bending,quotes,shadows.blur}
\begin{document}
\begin{frame}
\frametitle{Server Operating Systems}
\begin{tikzpicture}[overlay,remember picture]
\node[draw,circle,align=center,font=\large,shading=radial,
outer color=blue!55,middle color=blue!50,inner color=blue!20,
minimum size=1.5cm] at (5,0) (a) {A};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,left=.5cm of a,
font=\scriptsize] (b) {B};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,above=.5cm of a,
font=\scriptsize] (c) {C};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,right=.5cm of a,
font=\scriptsize] (d) {D};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,below=.5cm of a,
font=\scriptsize] (e) {e};
\draw[-,ultra thick,draw] (b.north) .. controls ($(b|-c)+(.7,-.5)$) .. (c.west);
\end{tikzpicture}
\end{frame}
\end{document}
如何绘制一个从北向东到西向东、从东向西到北向北、从南向东到东向西到北向南的环?
答案1
这可能是另一个例子smartdiagram
\documentclass{article}
\usepackage{smartdiagram}
\begin{document}
\smartdiagramset{planet color=orange!60,
distance planet-satellite=3cm,
font=\scriptsize
}
\smartdiagram[connected constellation diagram]
{A,B,C,D,E}
\end{document}
答案2
您可以使用语法(coord1) to[out=<angle>,in=<angle>] (coord2)
,例如
\draw (b.north) to[out=90,in=180] (c.west)
(c.east) to[out=0,in=90] (d.north)
(d.south) to[out=270,in=0] (e.east)
(e.west) to[out=180,in=270] (b.south);
如果你想要一个通过节点中心的实际圆,你可以添加库through
,然后使用
\scoped[on background layer]
\node [circle through=(c.center),draw,red] at (a.center) {};
\documentclass{beamer}
\usepackage{fontspec}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{decorations.text,calc,shapes,matrix,backgrounds,arrows,shadows,
positioning,fit,automata,decorations.pathreplacing,arrows.meta,bending,quotes,shadows.blur}
\begin{document}
\begin{frame}
\frametitle{Server Operating Systems}
\begin{tikzpicture}[overlay,remember picture]
\node[draw,circle,align=center,font=\large,shading=radial,
outer color=blue!55,middle color=blue!50,inner color=blue!20,
minimum size=1.5cm] at (5,0) (a) {A};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,left=.5cm of a,
font=\scriptsize] (b) {B};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,above=.5cm of a,
font=\scriptsize] (c) {C};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,right=.5cm of a,
font=\scriptsize] (d) {D};
\node[draw,circle,align=center,font=\large,shading=radial,minimum size=1cm,
outer color=blue!55,middle color=blue!50,inner color=blue!20,below=.5cm of a,
font=\scriptsize] (e) {e};
\draw (b.north) to[out=90,in=180] (c.west)
(c.east) to[out=0,in=90] (d.north)
(d.south) to[out=270,in=0] (e.east)
(e.west) to[out=180,in=270] (b.south);
\scoped[on background layer]
\node [circle through=(c.center),draw,red] at (a.center) {};
\end{tikzpicture}
\end{frame}
\end{document}