如何在 tikz 中绘制相互内的圆圈?

如何在 tikz 中绘制相互内的圆圈?

我想在彼此内部绘制四个圆圈,并在圆圈之间的区域绘制一些文字(命名该区域)。

到目前为止我得到:

\documentclass{article}

\usepackage{tikz}

\usetikzlibrary{shapes,backgrounds}

\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(45:2cm) circle (1.5cm)}
\def\thirdcircle{(0:2cm) circle (1.5cm)}
\def\fourthcircle{(0:2cm) circle (1.5cm)}

\begin{document}


\begin{tikzpicture}
    \draw \firstcircle node[below] {$first$};
    \draw \secondcircle node [above] {$second$};
    \draw \thirdcircle node [below] {$third$};
    \draw \fourthcircle node [below] {$fourth$};
\end{tikzpicture}

\end{document}

但我不知道该怎么做:

  1. 使一个圆圈比另一个圆圈大(第四个圆圈最大)
  2. 使文本不出现在圆圈的中间,而是出现在圆圈之间的区域(如果文本沿着圆圈弯曲会更好)
  3. 使圆圈彼此相互嵌套。

谢谢。

答案1

与 marmot 的答案类似,但使用节点表示圆圈并在其顶部添加装饰文本。

\documentclass[tikz,border=2mm]{standalone} 
\usetikzlibrary{positioning, decorations.text}

\begin{document}
\begin{tikzpicture}

\node[circle, minimum size=8cm, draw, fill=red] (a) {};
\node[circle, minimum size=6cm, draw, fill=green] (b) {};
\node[circle, minimum size=4cm, draw, fill=blue] (c) {};
\node[circle, minimum size=2cm, draw, fill=orange] (d) {O};

\draw [decorate, decoration={text along path, text = Some text for first circle}] (180:3.5) arc (180:0:3.5cm); 

\draw [decorate, decoration={text along path, text = Some text for second circle}] (150:2.5) arc (150:60:2.5cm); 

\draw [decorate, decoration={text along path, text = Some text for third circle}] (90:1.5) arc (90:-90:1.5cm); 

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

我确实没有完全理解你想要什么。这篇文章试图澄清这一点。这是一个生成半径增加的同心圆和一些注释的代码片段:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds}
\usetikzlibrary{decorations.text} % from https://tex.stackexchange.com/questions/268612/how-to-write-a-text-along-a-circle


\begin{document}


\begin{tikzpicture}
\draw[blue,postaction={decorate},decoration={text along path,
text={first},text align=center}]
(6,0) arc [start angle=0,end angle=360,radius=1];
\draw[blue,postaction={decorate},decoration={text along path,
text={second},text align=center}]
(5,-2) arc [start angle=-90,end angle=270,radius=2];
\draw[blue,postaction={decorate},decoration={text along path,
text={third},text align=center}]
(2,0) arc [start angle=-180,end angle=180,radius=3];
\draw[blue,postaction={decorate},decoration={text along path,
text={fourth},text align=center}]
(5,4) arc [start angle=-270,end angle=90,radius=4];
\end{tikzpicture}
\end{document}

在此处输入图片描述

如果这不是您想要的,我很乐意删除此帖子。

相关内容