我想要制作这样的图形:
\begin{tikzpicture}
\draw (0,0) circle [radius=10.75cm];
\draw (0,0) circle [radius=4.2cm];
\begin{scope}[even odd rule]
\draw[fill=gray!20,thick] (0,0) circle [radius=8cm] circle [radius=6cm];
\end{scope}
\draw [fill=white] node (x25) {} (6.042,1.053) circle [radius=1.05cm];
\draw [fill=white] (0.363,7.83) circle [radius=1.05cm] node[inner sep=2pt,circle,fill=black,pos=0.5] (x26) {};
\draw [fill=white] (-6.04,-1.069) circle [radius=1.05cm] node[inner sep=2pt,circle,fill=black,pos=0.5] (x27) {};
\draw [fill=white] (-0.35,-7.821) circle [radius=1.05cm] node[inner sep=2pt,circle,fill=black,pos=0.5] (x28) {};
\draw (0,0) -- (x25) node[pos=0.5,fill=white,circle] {$r_1$};
\draw (0,0) -- (x26) node[pos=0.4,fill=white,circle] {$r_2$};
\draw (0,0) -- (x27) node[pos=0.5,fill=white,circle] {$r_3$};
\draw (0,0) -- (x28) node[pos=0.4,fill=white,circle] {$r_4$};
\draw (0,0) -- ++(3.5,0);
\draw[->] (0:2.5cm) arc (0:9.893:2.5cm) node[pos=0.5,label={0:$\varphi_1$}] {};
\draw[->] (0:2.0cm) arc (0:87.347:2.0cm) node[pos=0.5,fill=white,circle] {$\varphi_2$};
\draw[->] (0:1.5cm) arc (0:190.0:1.5cm) node[pos=0.6,fill=white,circle] {$\varphi_3$};
\draw[->] (0:1cm) arc (0:267.37:1cm) node[pos=0.5,fill=white,circle] {$\varphi_4$};
\end{tikzpicture}
然而我只得到了这个:
从原点到节点的线x25
没有x28
出现。
有什么帮助吗?
答案1
由于您没有指定第一个节点应该在的位置,因此(x25)
将其放置在原点。通过将其定义移动到坐标之后,它会移动到您想要的位置。我只是评论了您无用代码的其他部分。但我没有简化您的代码。(0,0)
(6.042,1.053)
更新:更多解释
根据@JohnKormylo的评论,我寻找了这个错误的原因,除非我弄错了,否则这是因为路径简化为单点,而不是两个:当前点和前一个点。
这是您简化到最低限度的代码:
\draw [fill=white] (0.363,7.83) circle [radius=1.05cm] node[pos=0.5] (x26) {};
事实上,我引用的是手册第 151 页:
\路径...圆圈[<选项>] ...; 此命令会向当前路径添加一个圆,默认情况下圆心为当前点,但您可以使用 at 选项来更改此设置。新潮流 路径的点将是(通常只是保持)圆心。
手册第 235 页:
/tikz/pos=<分数> (无默认值) 当给出此选项时,节点不会锚定在最后一个坐标上。相反,它会锚定在从以前的协调到当前的观点。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) circle [radius=10.75cm]node[draw,circle,inner sep=2pt,fill=black]{};
\draw (0,0) circle [radius=4.2cm];
\begin{scope}[even odd rule]
\draw[fill=gray!20,thick] (0,0) circle [radius=8cm] circle [radius=6cm];
\end{scope}
\draw [fill=white] (6.042,1.053) circle [radius=1.05cm]node[draw,circle,inner sep=2pt,fill=black] (x25) {} ;
\draw [fill=white] (0.363,7.83) circle [radius=1.05cm]
[inner sep=2pt,circle,fill=black
%,pos=0.5
] (x26) {};
\draw [fill=white] (-6.04,-1.069) circle [radius=1.05cm] node
[inner sep=2pt,circle,fill=black
%,pos=0.5
]
(x27) {};
\draw [fill=white] (-0.35,-7.821) circle [radius=1.05cm] node
[inner sep=2pt,circle,fill=black
%,pos=0.5
]
(x28) {};
\draw (0,0) -- (x25) node[pos=0.5,fill=white,circle] {$r_1$};
\draw (0,0) -- (x26) node[pos=0.4,fill=white,circle] {$r_2$};
\draw (0,0) -- (x27) node[pos=0.5,fill=white,circle] {$r_3$};
\draw (0,0) -- (x28) node[pos=0.4,fill=white,circle] {$r_4$};
\draw (0,0) -- ++(3.5,0);
\draw[->] (0:2.5cm) arc (0:9.893:2.5cm) node[pos=0.5,label={0:$\varphi_1$}] {};
\draw[->] (0:2.0cm) arc (0:87.347:2.0cm) node[pos=0.5,fill=white,circle] {$\varphi_2$};
\draw[->] (0:1.5cm) arc (0:190.0:1.5cm) node[pos=0.6,fill=white,circle] {$\varphi_3$};
\draw[->] (0:1cm) arc (0:267.37:1cm) node[pos=0.5,fill=white,circle] {$\varphi_4$};
\end{tikzpicture}
\end{document}