如何在球体周围绘制偶极场线,像这样:
\begin{tikzpicture}[>=latex']
\tikzstyle{every node}=[font=\footnotesize]
\draw [thick, red] (-2,0) -- node [below] {+} (2,0) node (v3) {};
\draw [thick, red] (-2,2.5) --node [above] {$-$} (2,2.5) ;
\draw [blue] (0,0) -- (0,0.5);
\draw [blue] (0,1) ellipse (0.5 and 0.5);
\node [below] (v2) at (0,1.5) {\tiny +};
\node [above] (v1) at (0,0.5) {\tiny --};
\draw [->, blue] (0,0.75) -- (0,1.2) node [right] {$\vec p_{e}$};
\end{tikzpicture}
答案1
这是绘制极坐标图的解决方案。它与您的图片略有不同,但说实话,我并不是函数、图形等方面的专家。
我稍微改变了线条和东西的坐标(圆圈现在位于0,0
,0,1
而不是,它是一个节点,更容易用作参考),以及代码中的所有内容。
输出
代码
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,decorations.markings,backgrounds}
\tikzset{
every node/.style={font=\footnotesize},
}
\begin{document}
\begin{tikzpicture}[-]
\def\my{.5mm}
\draw [thick, red] (-2,-1) -- node [below] {+} (2,-1) node (v3) {};
\draw [thick, red] (-2,1) -- node [above] {$-$} (2,1) ;
\node[draw=blue, fill=white, circle, ,minimum size=1cm, inner sep=0, outer sep=0] (circ) at (0,0) {};
\draw [-{Latex},blue] (0,-1) -- (circ.south);
\node [below] (v2) at (0,.5) {\tiny +};
\node [above] (v1) at (0,-.5) {\tiny --};
\draw [-{Latex}, blue] (0,-.2) -- (0,.2) node [right] {$\vec p_{e}$};
%\path[clip] (-2,0) -- (2,0) -- (2,2) -- (-2,2) -- cycle;
\begin{scope}[scale=.3,on background layer]
\clip[scale=3.3] (-2,-1) rectangle (2,1);
\foreach \a [count=\b] in {1,2,3,4,5,6,7,8,9,10}{
\draw[domain=0:6.3,samples=500, line width=.1pt, decoration={markings,%
mark=at position 0.1 with {\arrow{Stealth[width=\my,length=\my]}},
mark=at position 0.4 with {\arrowreversed{Stealth[width=\my,length=\my]}},
mark=at position 0.5 with {\arrowreversed{Stealth[width=\my,length=\my]}},
mark=at position 0.6 with {\arrowreversed{Stealth[width=\my,length=\my]}},
mark=at position 0.9 with {\arrow{Stealth[width=\my,length=\my]}},
mark=at position 1 with {\arrow{Stealth[width=\my,length=\my]}},}, postaction=decorate] plot (xy polar cs:angle=\x r,radius={\a+\b*cos(2*\x r)});
}
\end{scope}
\end{tikzpicture}
\end{document}