如何用箭头和圆圈装饰线条

如何用箭头和圆圈装饰线条

我想画一个箭头(光线),上面覆盖垂直双箭头和圆圈(以显示 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}

在此处输入图片描述

相关内容