我想创建 3 个扇形圆节点。参见下图
扇区由线界定
答案1
更新 2
我认为比我的第一个版本更好的是使用样式。我在上次更新中添加了修改内部节点样式的可能性。
\documentclass[11pt]{scrartcl}
\usepackage{tikz}
%\usetikzlibrary{shapes} now not necessary
\begin{document}
\tikzset{sectors/.style n args={5}{%
circle,
draw,
minimum width=#4,
append after command={%
\pgfextra{ %
\draw (\tikzlastnode.center) -- (\tikzlastnode.south) ;
\draw (\tikzlastnode.west) -- (\tikzlastnode.east) ;
\path (\tikzlastnode.center) -- node[#5] {#1} (\tikzlastnode.north);
\path (\tikzlastnode.center) -- node[#5] {#2} (\tikzlastnode.south west);
\path (\tikzlastnode.center) -- node[#5] {#3} (\tikzlastnode.south east); } }}}
\begin{tikzpicture}[ultra thick]
\node [sectors={1}{2}{3}{4cm}{font=\Huge\bfseries,text=red}] (c) {};
\end{tikzpicture}
\end{document}
另一个想法
\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}[ultra thick]
\node [circle split,
draw,
minimum width=4cm,
append after command={%
\pgfextra{\draw (\tikzlastnode.center) -- (\tikzlastnode.south) ;
}
}] (c) {};
\node[yshift=2em] at (c.center) {\huge \textbf{1}};
\node[xshift=-2em,yshift=-2em] at (c.center) {\huge \textbf{2}};
\node[xshift= 2em,yshift=-2em] at (c.center) {\huge \textbf{3}};
\end{tikzpicture}
\end{document}
答案2
你可以做这样的事情:
\documentclass{article}
\usepackage{tikz}
\newlength\radius
\setlength\radius{7mm}
\begin{document}
\begin{tikzpicture}
\draw circle (\radius);
\draw +(-\radius,0) -- +(\radius,0);
\draw +(0,-\radius) -- +(0,0);
\node[font=\Large\sffamily] at (0,0.5\radius) {1};
\node[font=\Large\sffamily] at (-0.35\radius,-0.5\radius) {2};
\node[font=\Large\sffamily] at (0.35\radius,-0.5\radius) {3};
\end{tikzpicture}
\end{document}
现在我重新阅读了这个问题,我发现你想要使用 \node 来表示圆圈,所以这里有一些使用 \node 的可能解决方案:
\documentclass{article}
\usepackage{tikz}
\newlength\diam
\setlength\diam{14mm}
\begin{document}
\begin{tikzpicture}
\node[draw,circle,inner sep=0pt,minimum width=\diam] (circ) {};
\draw (circ.180) -- (circ.0);
\draw (circ.270) -- +(0,0.5\diam);
\node[font=\Large\sffamily,yshift=0.25\diam] at (circ.center) {1};
\node[font=\Large\sffamily,xshift=-0.18\diam,yshift=-0.25\diam] {2};
\node[font=\Large\sffamily,xshift=0.18\diam,yshift=-0.25\diam] {3};
\end{tikzpicture}
\end{document}
答案3
这里有两个解决方案:第一个解决方案直接源自 Gonzalo Medina 的解决方案。第二个解决方案使用更“稳健”的技术(通过fit
库):材料不得超出圆周。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,fit}
\begin{document}
\begin{tikzpicture}
\node[draw,circle,inner sep=0pt,minimum width=3.5em] (circ) {};
\draw (circ.180) -- (circ.0);
\draw (circ.270) -- (circ.center);
\path (circ.center) -- node{1}(circ.90);
\path (circ.center) -- node{2}(circ.-135);
\path (circ.center) -- node{3}(circ.-45);
\end{tikzpicture}
\begin{tikzpicture}
\coordinate (center) at (0,0);
\node[above=0mm of center](p1){1};
\node[below left=0mm of center](p2){2};
\node[below right=0mm of center](p3){3};
\node[draw,inner sep=0pt,circle,fit=(p1)(p2)(p3)](c){};
\draw (center) -- (c.0);
\draw (center) -- (c.180);
\draw (center) -- (c.-90);
\end{tikzpicture}
\end{document}
答案4
[fr] 我似乎认为所提出的解决方案不够有力
需要修改 PolGab 的 2eme 解决方案以获得适合字符名称的解决方案,并且准确度很高
[en] 在我看来,提出的解决方案都不可靠
需要稍微修改第二个 PolGab 解决方案,以获得适应指定节点中心的字符数量的解决方案
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,fit}
\begin{document}
\begin{tikzpicture}
\coordinate (center) at (0,0);
\node[above=0mm of center](p1){1};
\node[below left=0mm of center](p2){2};
\node[below right=0mm of center](p3){3};
\node[draw,inner sep=0pt,circle,fit=(p1)(p2)(p3)](c)at (center){};
\draw (center) -- (c.0);
\draw (center) -- (c.180);
\draw (center) -- (c.-90);
\end{tikzpicture}
\begin{tikzpicture}
\coordinate (center) at (0,0);
\node[above=0mm of center](p1){1};
\node[below left=0mm of center](p2){2};
\node[below right=0mm of center](p3){312};
\node[draw,inner sep=0pt,circle,fit=(p1)(p2)(p3)](c)at (center){};
\draw (center) -- (c.0);
\draw (center) -- (c.180);
\draw (center) -- (c.-90);
\end{tikzpicture}
\end{document}