平均能量损失
现在我想用 Tikz 创建它。因此,我已经得到了一个 MWE:
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\definecolor{g1}{RGB}{235,240,245}
\definecolor{g2}{RGB}{223,230,237}
\definecolor{g3}{RGB}{205,217,225}
\definecolor{g4}{RGB}{190,205,215}
\definecolor{g5}{RGB}{173,190,203}
\definecolor{g6}{RGB}{155,175,190}
\definecolor{g7}{RGB}{135,155,170}
\begin{document}
\begin{tikzpicture}
\clip (0,0) rectangle (7,1.75);
\foreach \n [count=\i] in {28,24,...,4}{
\fill[g\i, draw=black] (28em,0) circle (\n em);
}
\draw[black, line width=0.75pt] (0,0) -- (7,0) -- (7,1.75) -- (0.215,1.75);
\end{tikzpicture}
\end{document}
结果
问题
我怎样才能重现第一幅图所示的文字?
除了文本之外:我的 MWE 是否最佳?(在尺寸调整(仅使用 7 厘米宽度,这将导致文本非常大)和重复功能的编码方面。)
答案1
这是一个可能的解决方案:
输出
代码
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text, intersections}
\definecolor{g8}{RGB}{255,255,255} %to trick foreach
\definecolor{g1}{RGB}{235,240,245}
\definecolor{g2}{RGB}{223,230,237}
\definecolor{g3}{RGB}{205,217,225}
\definecolor{g4}{RGB}{190,205,215}
\definecolor{g5}{RGB}{173,190,203}
\definecolor{g6}{RGB}{155,175,190}
\definecolor{g7}{RGB}{135,155,170}
\tikzset{
curvetext/.style n args={4}{postaction={decorate,
decoration={
text along path,
text={|\sffamily#2|#3},
text align={center, left indent=1mm, #4},
raise=#1,
reverse path,
%text effects/.cd,
every character/.style={draw},
%text width=2cm,
}}}
}
\begin{document}
\begin{tikzpicture}
\clip (-.1,0) rectangle (28em,2);
\foreach \angle/\texta/\textb [count=\j, evaluate=\j as \x using int(32-4*\j)] in {%
0/,
-6/Zaun mit Tor/,
-7/Uberwachungs-/kameras,
-9/verschlossene/Schaltwarte,
-11/pw-geschutzte/Bedienung,
-25/,
-32/verschlossene/Schaltschranke,
20/2-Augen-/prinzip
}{%
\ifnum\j=8
\path[
curvetext={-3mm}{\scriptsize\phantom{,}}{\texta}{},
curvetext={-6mm}{\scriptsize\phantom{,}}{\textb}{},
]
(28em,4em) arc (90:180:4em);
\else
\begin{scope}[shift={(28em,0)}]
\draw[
fill=g\j, rotate=\angle,
curvetext={7mm}{\scriptsize}{\texta}{},
curvetext={4mm}{\scriptsize}{\textb}{}
]
(0,0) circle (\x em);
\end{scope}
\fi
}%
\path[name path=circ] (28em,0) circle (28em);
\path[name path=horiz] (-.1,2) --++ (5,0);
\path[name intersections={of=circ and horiz,by=E}];
\draw (E) -| (28em,0) -- (0,0);
\end{tikzpicture}
\end{document}