答案1
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}[showgrid](-7,-7)(7,7)
\multido{\ix=-5+1}{11}{\multido{\iy=-5+1}{11}{%
\ifnum\numexpr\ix*\ix+\iy*\iy\relax=0\relax
\else
\rput(\ix,\iy){\psline[linecolor=red,ArrowInside=->](!\ix\space \iy\space 2 copy Pyth dup 3 1 roll div 3 1 roll div 2 sqrt dup 3 1 roll mul 3 1 roll mul)}
\fi
}}
\end{pspicture}
\end{document}
答案2
同时还有另一种pgfplots
选择。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view={0}{90},domain=-4:4]
\addplot3 [blue,-stealth,samples=16,
quiver={
u={2*x/pow(x^2 + y^2,1/2)},
v={2*y/pow(x^2 + y^2,1/2)},
scale arrows=0.2,
},
] { 1}; % use pow(x^2 + y^2,1/2) if you choose to have a real 3D plot
\end{axis}
\end{tikzpicture}
\end{document}
答案3
\documentclass[pstricks,border=1cm]{standalone}
\usepackage{pst-plot,pst-ode}
\psset{unit=3,algebraic}
\begin{document}
\begin{pspicture}(-1.1,-1.1)(1.1,1.1)
\psclip{\psframe[linestyle=none,linewidth=0](0,-1)(1,1)}
\psVectorfield[linecolor=red](0.1,-1)(1,1){y/x}
\endpsclip%
\psclip{\psframe[linestyle=none,linewidth=0](-1,-1)(0,1)}
\psVectorfield[linecolor=red,Dx=-0.1](-1,-1)(0.1,1){y/x}
\endpsclip%
\psaxes[ticksize=0 4pt,axesstyle=frame,tickstyle=inner,subticks=20,Ox=-1,Oy=-1](-1,-1)(1,1)
\psaxes[linecolor=red,ticks=none,labels=none,linewidth=0.2pt](0,0)(-1,-1)(1,1)
\end{pspicture}
\end{document}