![如何用一半一半的颜色绘制边框](https://linux22.com/image/413167/%E5%A6%82%E4%BD%95%E7%94%A8%E4%B8%80%E5%8D%8A%E4%B8%80%E5%8D%8A%E7%9A%84%E9%A2%9C%E8%89%B2%E7%BB%98%E5%88%B6%E8%BE%B9%E6%A1%86.png)
在下面的代码中,我如何在圆圈周围画线,使得一半是蓝色,一半是红色(双色圆圈边框)?
\node[circle, draw=blue,line width=.5mm] at (0, 0) [label=center:{($A$)}] (A) {};
答案1
这就是我们dash patterns
的用途。以下是一些基本示例。
\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
\node[circle, draw=blue,dash pattern=on pi*0.5em off pi*0.5em,
postaction={draw=red,dash phase=pi*0.5em},
,line width=.5mm,minimum size=1em] at (0, 0) [label=center:{($A$)}] (A) {};
\node[circle, draw=blue,dash pattern=on pi*1em off pi*1em,
postaction={draw=red,dash phase=pi*1em},
,line width=.5mm,minimum size=2em] at (2, 0) [label=center:{($A$)}] (A) {};
\end{tikzpicture}
\end{document}
显然,您可以将其设为一种风格。(如果需要拼写出来,请告诉我。)