![如何用箭头和圆圈装饰线条](https://linux22.com/image/272168/%E5%A6%82%E4%BD%95%E7%94%A8%E7%AE%AD%E5%A4%B4%E5%92%8C%E5%9C%86%E5%9C%88%E8%A3%85%E9%A5%B0%E7%BA%BF%E6%9D%A1.png)
我想画一个箭头(光线),上面覆盖垂直双箭头和圆圈(以显示 s 和 p 极化),但我对装饰命令感到困惑。我已经包含了目前所拥有的内容,您能帮助我进一步吗?
我目前拥有的:
(粗糙的模型)我想要的:
\documentclass{article}
\usepackage{tikz, pgfplots}
\usetikzlibrary{shapes,arrows,positioning,decorations.markings}
\begin{document}
\begin{tikzpicture}[scale=0.7]
\draw [red, line width=1mm, <-] (0,0) -- (150:5.2)
[postaction={decorate,decoration={markings,
mark=between positions 0.2 and 0.9 step 0.2 with {\arrow[red, line width=1mm]{|};}
}}]
[postaction={decorate,decoration={markings,
mark=between positions 0.3 and 0.9 step 0.2 with {\circle{8};}
}}]
;
\end{tikzpicture}
\end{document}
答案1
标记具有局部坐标系,其中 x 方向沿切线,y 方向沿法线,因此您可以使用该坐标系绘制事物。
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes,arrows,positioning,decorations.markings}
\begin{document}
\begin{tikzpicture}[scale=0.7]
\draw [red, line width=1mm, <-,
postaction={decorate,decoration={markings,
mark=between positions 0.2 and 0.9 step 0.2 with {\draw [<->,red,thin] (0,-2mm) -- (0,2mm);}
}}
,postaction={decorate,decoration={markings,
mark=between positions 0.3 and 0.9 step 0.2 with {\draw[thin,blue] circle (3pt);}
}}]
(0,0) -- (150:5.2);
\end{tikzpicture}
\end{document}