该代码来自@marmot 的回复:修改 arcarrow
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{decorations.text}
\definecolor{mygray}{RGB}{208,208,208}
\definecolor{mymagenta}{RGB}{226,0,116}
\newcommand*{\mytextstyle}{\sffamily\Large\bfseries\color{black!85}}
\begin{document}
\begin{tikzpicture}
\fill[mymagenta] circle (1.35);
\node at (0,0) [
font = \mytextstyle,
color = white,
align = center
]{
PDCA\\
Cycle
};
\pgfmathsetmacro{\mydist}{2}
\pgfmathsetmacro{\Radius}{2}
\foreach \X [count=\Y] in {PLAN,DO,CHECK,ACT}
{\pgfmathtruncatemacro{\itest}{sign(sin(180-\mydist-90*\Y))}
\ifnum\itest>0
\draw[mygray,line width=1cm,postaction={decoration = {
text along path,
text = {|\mytextstyle|\X},
text align = {align = center},
raise = -1.0ex
},
decorate}] (180-\mydist-90*\Y:\Radius) arc(180-\mydist-90*\Y:90+\mydist-90*\Y:\Radius);
\else
\draw[mygray,line width=1cm,postaction={decoration = {
text along path,
text = {|\mytextstyle|\X},
text align = {align = center},
raise = -1.0ex
},
decorate}] (90+\mydist-90*\Y:\Radius) arc(90+\mydist-90*\Y:180-\mydist-90*\Y:\Radius);
\fi
}
\end{tikzpicture}
\end{document}
是否可以为每个弧形箭头对象设置不同的颜色?非常感谢。
答案1
颜色来自 draw 命令,特别是 colour 的使用mygray
。您需要做的就是更改它们。例如,您可以通过向循环添加颜色来为每个颜色使用不同的颜色\foreach
:
以下是 marmot 的漂亮代码的更新:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{decorations.text}
\definecolor{mygray}{RGB}{208,208,208}
\definecolor{mymagenta}{RGB}{226,0,116}
\newcommand*{\mytextstyle}{\sffamily\Large\bfseries\color{black!85}}
\begin{document}
\begin{tikzpicture}
\fill[mymagenta] circle (1.35);
\node at (0,0) [
font = \mytextstyle,
color = white,
align = center
]{
PDCA\\
Cycle
};
\pgfmathsetmacro{\mydist}{2}
\pgfmathsetmacro{\Radius}{2}
\foreach \X/\col [count=\Y] in {PLAN/blue!10,DO/red!10,CHECK/green!10,ACT/orange!10}
{\pgfmathtruncatemacro{\itest}{sign(sin(180-\mydist-90*\Y))}
\ifnum\itest>0
\draw[\col,line width=1cm,postaction={decoration = {
text along path,
text = {|\mytextstyle|\X},
text align = {align = center},
raise = -1.0ex
},
decorate}] (180-\mydist-90*\Y:\Radius) arc(180-\mydist-90*\Y:90+\mydist-90*\Y:\Radius);
\else
\draw[\col,line width=1cm,postaction={decoration = {
text along path,
text = {|\mytextstyle|\X},
text align = {align = center},
raise = -1.0ex
},
decorate}] (90+\mydist-90*\Y:\Radius) arc(90+\mydist-90*\Y:180-\mydist-90*\Y:\Radius);
\fi
}
\end{tikzpicture}
\end{document}