![如何绘制不同层的圆形图?](https://linux22.com/image/454835/%E5%A6%82%E4%BD%95%E7%BB%98%E5%88%B6%E4%B8%8D%E5%90%8C%E5%B1%82%E7%9A%84%E5%9C%86%E5%BD%A2%E5%9B%BE%EF%BC%9F.png)
答案1
开始的事情:
\documentclass[tikz, border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}[myline/.style={white, line width=1mm}]
\fill[blue!15] (0,0)--(0:4) arc (0:180:4)--cycle;
\fill[red!15] (0,0)--(0:4) arc (0:-180:4)--cycle;
\fill[blue!20] (0,0)--(0:3) arc (0:180:3)--cycle;
\fill[blue!5] (0,0)--(0:2) arc (0:180:2)--cycle;
\fill[red!10] (0,0)--(0:2) arc (0:-180:2)--cycle;
\fill[gray!5] (0,0) circle(1cm);
\draw[myline] (0,0) circle(1cm) circle(2cm);
\draw[myline] (180:3) arc(180:0:3cm);
\draw[myline] (-1,0)--++(180:3cm) (1,0)--++(0:3cm) (0,2)--++(90:1cm);
\draw[myline] (-60:2)--++(-60:2cm) (-120:2)--++(-120:2cm);
\node {A};
\node at (0,1.5) {B};
\node at (0,-1.5) {C};
\node at (135:2.5) {D};
\node at (45:2.5) {E};
\node at (-150:3) {F};
\node at (-90:3) {G};
\node at (-30:3) {H};
\node at (90:3.5) {I};
\end{tikzpicture}
\end{document}
答案2
以下答案使用轮图包,是我写的。
弧之间的间隙是通过键gap
和获得的gap radius
。
该图由多个轮图组成。A radius
、start angle
和total angle
分别指定。
\documentclass[border=6pt]{standalone}
\usepackage{wheelchart}
\begin{document}
\begin{tikzpicture}
\pgfkeys{
/wheelchart,
data=,
gap,
gap radius,
slices style=\WCvarA,
value=1,
wheel data=\WCvarB,
wheel data pos=0.5
}
\wheelchart[
middle=A,
radius={1}{2},
start angle=180
]{blue!5/B,red!5/C}
\wheelchart[
radius={2}{3},
start angle=180,
total angle=180
]{blue!20/D,red!20/E}
\wheelchart[
radius={2}{4},
start angle=0,
total angle=180
]{red!15/H,red!15/G,red!15/F}
\wheelchart[
radius={3}{4},
start angle=180,
total angle=180
]{blue!10/I}
\end{tikzpicture}
\end{document}